Re: Counting the elements of an array

2002-05-20 Thread drieux
On Sunday, May 19, 2002, at 09:58 , Octavian Rasnita wrote: > I don't know the map function. > > Teddy, > [EMAIL PROTECTED] I think the short answer is: this is a good thing for the moment. perldoc -f map if that does the 'fast make of a hash or list' from a list that works fo

Re: Counting the elements of an array

2002-05-20 Thread Octavian Rasnita
I don't know the map function. Teddy, [EMAIL PROTECTED] - Original Message - From: "drieux" <[EMAIL PROTECTED]> To: "cgi cgi-list" <[EMAIL PROTECTED]> Sent: Monday, May 20, 2002 7:25 AM Subject: Re: Counting the elements of an array On Sund

Re: Counting the elements of an array

2002-05-20 Thread Tagore Smith
Bob Showalter wrote: > > -Original Message- > > From: drieux [mailto:[EMAIL PROTECTED]] > > Sent: Monday, May 20, 2002 3:01 PM > > To: cgi cgi-list > > Subject: Re: Counting the elements of an array > > > > > > > > O

RE: Counting the elements of an array

2002-05-20 Thread Bob Showalter
> -Original Message- > From: drieux [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 20, 2002 3:01 PM > To: cgi cgi-list > Subject: Re: Counting the elements of an array > > > > On Monday, May 20, 2002, at 08:13 , Bob Showalter wrote: > >> -Ori

Re: Counting the elements of an array

2002-05-20 Thread drieux
On Monday, May 20, 2002, at 08:13 , Bob Showalter wrote: >> -Original Message- >> From: drieux [mailto:[EMAIL PROTECTED]] >> >># >># >>sub haveMap { >> my (@list) = @_; >> my %seen = (); >> >> map {$seen{$_}++} @list; > > So, is the old s

RE: Counting the elements of an array

2002-05-20 Thread Bob Showalter
> -Original Message- > From: drieux [mailto:[EMAIL PROTECTED]] > Sent: Sunday, May 19, 2002 11:47 AM > To: cgi > Subject: Re: Counting the elements of an array > > ... > ok, so my OCD is benchmarking - but I would like to offer > what I think may be a bit quic

Re: Counting the elements of an array

2002-05-19 Thread drieux
On Sunday, May 19, 2002, at 06:29 , Octavian Rasnita wrote: > I couldn't understand anything, but thank you very much! :-) my apologies - how can I help make it more understandable? > I could use the other solutions very easy, but now I have another problem. better a solution than None! > I

Re: Counting the elements of an array

2002-05-19 Thread Octavian Rasnita
gt; To: "cgi" <[EMAIL PROTECTED]> Sent: Sunday, May 19, 2002 6:47 PM Subject: Re: Counting the elements of an array On Saturday, May 18, 2002, at 07:09 , Tagore Smith wrote: > You're on the right track. Try something like this: > > my @array=("aaa", "

not really a contention - was Re: Counting the elements of an array

2002-05-19 Thread drieux
On Sunday, May 19, 2002, at 02:38 , Tagore Smith wrote: > drieux wrote: [..] >> http://www.wetware.com/drieux/pbl/BenchMarks/uniqCounts.txt >> >> ok, so my OCD is benchmarking - Tagore - thanks for the review - and I fear we agree, although I feel I owe you some clarifications; [..] > and makin

Re: Counting the elements of an array

2002-05-19 Thread Tagore Smith
drieux wrote: > 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}++; > > } > >

Re: Counting the elements of an array

2002-05-19 Thread drieux
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.

Re: Counting the elements of an array

2002-05-18 Thread Tagore Smith
Octavian Rasnita wrote: > I have an array with values like: > my @array=("aaa", "aaa", "bbb", "bbb", "aaa", "ccc", "aaa", "bbb", "ccc", > ); > > I want to count how many "aaa" and how many "bbb" and how many "ccc" and how > many "..." I have in that array.I would like to > have a hash with s

Counting the elements of an array

2002-05-18 Thread Octavian Rasnita
Hi all, I have an array with values like: my @array=("aaa", "aaa", "bbb", "bbb", "aaa", "ccc", "aaa", "bbb", "ccc", ); I want to count how many "aaa" and how many "bbb" and how many "ccc" and how many "..." I have in that array.I would like to have a hash with something like: %hash=( aaa =>