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: regular expression vs split

2002-05-19 Thread Ross Esposito
I "think" split is compiled only once while regex (as used in the previous posts) is compiled everytime a new line is to be matched. (you can use qr//) Someone fire up Benchmark. I could be wrong :) xgunnerx -Original Message- From: Scot Robnett [mailto:[EMAIL PROTECTED]] Sent: Friday,

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}++; > > } > >

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: regular expression vs split

2002-05-19 Thread drieux
On Sunday, May 19, 2002, at 02:30 , Ross Esposito wrote: > I "think" split is compiled only once while regex (as used in the previous > posts) is compiled everytime a new line is to be matched. (you can use qr/ > /) > > Someone fire up Benchmark. I could be wrong :) > > xgunnerx funny you shoul

Re: Counting the elements of an array

2002-05-19 Thread Octavian Rasnita
I couldn't understand anything, but thank you very much! :-) I could use the other solutions very easy, but now I have another problem. I should try to understand your code. Cheers. Teddy, [EMAIL PROTECTED] - Original Message - From: "drieux" <[EMAIL PROTECTED]> To: "cgi" <[EMAIL PROTECT

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