Why use grep if you're not returning a list?
I use grep to create the list of keys and then use map to conver the keys into key/value pairs, which I then assign to the new hash:
my %new_hash = map { $_ => $original_hash{$_} } grep {/foo/} keys %ori +ginal_hash;
In reply to Re: grep for hash?
by Corion
in thread grep for hash?
by rovf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |