#/usr/bin/perl -w use strict; my @array1 = ('one','two','one','three','four','two','one'); my @array2 = (); my $index; my $in; foreach $in (@array1) { push(@array2,$in) if (!grep $array2[$_] eq $in, 0 .. $#array2); } print "@array1\n"; print "@array2\n"; __DATA__ # the result : one two one three four two one one two three four