use strict; my %hash = ( 1 => 'a' , 2 => 'b' , 3 => 'c' , 4 => 'b' , 5 => 'e' , 6 => 'b' , 7 => 'a' , 8 => 'z' ); my %values_with_multiple_keys = (); foreach my $k (keys %hash) { push @{ $values_with_multiple_keys{$hash{$k}} }, $k; } foreach my $m (keys %values_with_multiple_keys) { if (scalar @{$values_with_multiple_keys{$m}} > 1) { print "$m is referenced by: ", join ', ', @{$values_with_multiple_keys{$m}}, "\n"; } } ___OUTPUT___ a is referenced by: 7, 1, b is referenced by: 6, 2, 4,