foreach (@array) { $hash{$_}++; } foreach (keys %hash) { delete $hash{$_} if ($hash{$_} > 1); } @array2 = keys %hash;