Well, building a useful reverse index in cases where you don't have a 1:1 mapping isn't too bad (although not as elegant):
(given %index)
my %revindex; for my $revpair (map { [ $index{$_}, $_ ] } keys(%index)) { push @{$revindex{$revpair->[0]}}, $revpair->[1]; }
There are probably simpler ways to do even that, however.
In reply to non-1:1 mappings
by Anonymous Monk
in thread Finding a hash key from the value (reverse lookup)
by ryddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |