On Saturday, May 18, 2002, at 07:09 , Tagore Smith wrote:
> You're on the right track. Try something like this: > > my @array=("aaa", "aaa", "bbb", "bbb", "aaa", "ccc", "aaa", "bbb", "ccc") > my %hash; > > foreach my $item (@array){ > $hash{$item}++; > } > > Tagore Smith http://www.wetware.com/drieux/pbl/BenchMarks/uniqCounts.txt ok, so my OCD is benchmarking - but I would like to offer what I think may be a bit quicker - if speed is your Need... #------------------------ # sub haveMap { my (@list) = @_; my %seen = (); map {$seen{$_}++} @list; \%seen ; } # end of haveMap ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]