12345678
my @sorted = sort @array;my @clean = ();my $before = undef;foreach (@sorted) { push @clean, $_ if (not defined $before) or ($_ ne $before); $before = $_;}