Mark Overmeer wrote:
'uniq' differs from 'sort' because there is no order relationship between
the elements.  A quick algorithm for finding the unique elements in perl5
is
   sub uniq(@)
   {  my %h = map { ($_ => 1) } @elements;
      keys %h;
   }


...and an even quicker one is:

 use Set::Object;
 sub uniq(@)
 {
     set(@_)->members;
 }

or

 use v6;
 use Set;
 sub uniq([EMAIL PROTECTED])
 {
     set(@items).members;
 }

Sam.

Reply via email to