in reply to Remove duplicate key value pair in hash

Kind of an odd question, they are not the same key value pairs; unless you mean numeral versus spelled number(?). They are flipped key value pairs. You have to make a choice which is the side to remove or call a duplicate. This may or may not do what you expect–

use Data::Dump "pp"; my %hash = ('one' => '1', 'two' => '2','1'=>'one'); my %seen; for my $key ( keys %hash ) { delete $hash{$key} if $seen{$key} || $seen{$hash{$key}}; $seen{$key}++; $seen{$hash{$key}}++; } pp \%hash; -- { 1 => "one", two => 2 }