in reply to getting hash key with value
This is trivial using List::Pairwise, even if the values aren't unique.
Even if you think that your values are unique it's sometimes a good idea to assert this:use List::Pairwise 'mapp'; my %hash = ( foo => 1, bar => 2, baz => 1, bux => 0, ); my $val = $hash{foo}; my @keys = mapp { $b eq $val ? $a : () } %hash; print "@keys"; __END__ baz foo
my ($key, @too_many) = mapp { $b eq $val ? $a : () } %hash; ! @too_many or die 'Too many ...';
lodin
In Section
Seekers of Perl Wisdom