http://qs321.pair.com?node_id=1077407


in reply to Create unique array --the hard way!

foreach my $elem (@sorted) { push @uniq, $elem if !@uniq || $elem ne $uniq[-1]; } # OR my @uniq = shift @sorted; $uniq[-1] ne $_ && push @uniq, $_ for @sorted;