Another issue to be aware of is duplicate values. This can be handled by doing a bit more work with the inversion:
my %hash_inverted; for (keys %hash) { my $value = $hash{$_}; push @{ $hash_inverted{$value} }, $_; }
This way each value in the inverted hash will be an array reference, which contains all the keys that value corresponds to.
In reply to Re^3: grep value in hash
by revdiablo
in thread grep value in hash
by kanish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |