use strict; my @arr = ("A", "B", "ABB", "C", "ABB", "B","C" ); my %hash = (); my @list = (); foreach my $word (@ary) { push( @list,$word ) unless $hash{$item}++; } print join("\n", @list), "\n";