The former implementation can be shortened: sub uniq { my %h; return grep { ! $h{$_}++ } @_; }
But realize that none of the proposed solutions (which are based on hashes for computing the return) is amenable to the extension Ingo called for with comparator blocks. Adriano.