exists $$all_names{$name}; %$all_names ~~ $name; # Shortcut using the smartmatch operator #### @good = grep { %$all_names ~~ $_ } @arr_of_names;