my %revhash; while (my($k, $v) = each %hash) { push @{$revhash{$v}}, $k; } for my $val (sort { $a <=> $b } keys %revhash) { my @keys = @{$revhash{$_}}; if (@keys > 1) { # only items where there's a tie print "$val is shared by @keys\n"; } }