my @test = ("camel","aplaca","peguin","aplaca","monkey","camel","camel"); my (%duplicate,%test,@redundant); for (@test) { $duplicate{$_} = 1 if defined $test{$_}; $test{$_} = 1; } @redundant = keys %duplicate; print "@redundant\n";