%h=(1 => 2, 3 => 2, 4 => 3); $val = 2; # use eq for strings, or whatever equals method for objects @keys = grep {$h{$_} == $val} keys %h; # (1,3)
Originally posted as a Categorized Answer.
In reply to Re: Get the Key corresponding to any given value
by codeacrobat
in thread Get the Key corresponding to any given value
by rmalhotra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |