If you want the list of matches, use an array:
my @matches = grep /$regex/, keys %tax2loc
This puts grep into list context, thus returning a list of all matches (and not just the number of matches).
In reply to Re: grep keys in hash and retrieve values
by moritz
in thread grep keys in hash and retrieve values
by AWallBuilder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |