in reply to remove duplicates

Hi,

This question pops up once and a while. It is mostly referred to as:"how to find unique elements in an array", as you can easily split you string on " "'s.
I was wondering, why isn't there a unique method in perl?
This seems quite usefull.
Anyway, I defined mostly a UNIVERSAL method like this

sub unique { my $self=shift; my %tmp; map { %tmp{$_}=1 } @_; return keys %tmp; }
and just call it like :
$o->unique(@array); # with $o my blessed object
But, anyway, since blakem and joe++ gave perfectly good answers, I rest my case :-)
---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium