in reply to How to extract keyvalue pairs with duplicate values

This code build a new hash with the values as keys and collect all keys that point to this value.
my %h = ( a => 10, b => 10, c => 'd', e => 'd', f => 'a', ); my %x; while ( my ( $k, $v ) = each %h ) { push @{ $x{$v} }, $k; } __END__ $x = { 'a' => [ 'f' ], '10' => [ 'a', 'b' ], 'd' => [ 'e', 'c' ] };
If you just want to remove the duplicates try:
my %n = reverse %h; %n = reverse %n;
Boris