in reply to How to extract keyvalue pairs with duplicate values

You could build up a reverse hash with arrayrefs, then count the length of those:
my %forward_hash = (... your hash...); ## accumulate the reverse mapping my %reverse_hash; while (my($k, $v) = each %forward_hash)) { push @{$reverse_hash{$v}}, $k; } ## now see if there are dups: while (my($k, $v) = each %reverse_hash)) { my @vals = @$v; next unless @vals > 1; # skip single values print "value $k is shared by keys @vals\n"; }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.