in reply to Re: Re: Finding a hash key from the value (reverse lookup)
in thread Finding a hash key from the value (reverse lookup)

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.

Replies are listed 'Best First'.
Re: non-1:1 mappings
by PsychoSpunk (Hermit) on Jan 23, 2001 at 04:24 UTC