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;
In reply to Re: Create unique array --the hard way!
by hazylife
in thread Create unique array --the hard way!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |