$HASH1 = { 'Alabama' => [ 'Andalusia', 'Anniston', 'Clanton', 'Eufaula', 'Auburn', 'Bessemer', 'Eufaula', 'Auburn', 'Bessemer', ], 'California' => ['Barstow','Barstow'], 'Georgia' => ['Darien'], 'New York' => [ 'Amsterdam','Coney Island','Coney Island', 'Becon','Becon', ], }; for my $key ( keys %$HASH1 ) { my $arrayref = $HASH1->{$key}; my %seen; # empty at each iteration $seen{$_}++ for @$arrayref; # process array from the end towards beginning for my $index ( reverse 0 .. $#$arrayref ) { if ( $seen{$arrayref->[$index]} > 1 ) { $seen{$arrayref->[$index]}--; $removed = splice @$arrayref, $index, 1; print "key $key: removed '$removed'\n"; } } } dd $HASH1; __END__ key Alabama: removed 'Bessemer' key Alabama: removed 'Auburn' key Alabama: removed 'Eufaula' key New York: removed 'Becon' key New York: removed 'Coney Island' key California: removed 'Barstow' { "Alabama" => [ "Andalusia", "Anniston", "Clanton", "Eufaula", "Auburn", "Bessemer", ], "California" => ["Barstow"], "Georgia" => ["Darien"], "New York" => ["Amsterdam", "Coney Island", "Becon"], }