use strict; use warnings; my %hash = ( foo => "bar", bar => "baz", baz => "bar" ); print join ", ", find_key( \%hash, 'bar' ); print "\n"; sub find_key { my ( $hash, $val ) = @_; grep { $$hash{$_} eq $val } keys %$hash; }