%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)