Hacker News new | ask | show | jobs
by raiph 2749 days ago
English contains ambiguous words. What does "contains" mean in the previous sentence? In P6 it means searching a string for a substring. Your code asks P6 to treat @menu as a string. If you want to treat it as a list and grep that list then use grep:

    my @menu = <hamburger fries milkshake>;
    say so @menu.grep('hamburger');            # True 
    say so @menu.grep('hot dog');              # False 
    say so @menu.grep('milk');                 # False 
    say so @menu.grep('er fr');                # False 
    say so @menu.grep(<es mi>);                # False