in reply to grep for hash?

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;