in reply to Get the Key corresponding to any given value
%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) [download]
Originally posted as a Categorized Answer.