my @a= (1,2,3,4,5,6,6,5,4,3,2,1); my %help; my @wasted_array = map { $help{$_}=1 } @a; @a = keys %help; print @wasted_array, "\n", @a;