On Wednesday, May 1, 2002, at 05:10 , Andrew Rosolino wrote:

> Say I have an array that contains!
>
> @array = qw( cool cool dog dog dog );
>
> Now I want to sum that up, so that the array only has
> 1 COOL and 1 DOG, so it would contain!
>
> @array = qw( cool dog );

we just went around this on the beginner's mailing list and a
bench mark of the basic solutions is up at:


http://www.wetware.com/drieux/CS/lang/Perl/Beginners/BenchMarks/benchMarkingDeDuping.
txt

Jenda offered up the really slick one:
###     my @new_array;
###     { my %h; @h{@array} = (); @new_array = keys %h; }


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to