in reply to Re^2: grep value in hash
in thread grep value in hash
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.
|
---|