my %multiples; my @out; for (@in) { push @out, $_ if ($multiples{$_}++ == 1) } print "@out";