[prev in list] [next in list] [prev in thread] [next in thread]
List: cgi-list
Subject: Re: [CGI] Perl counting question
From: Dave Cross <dave () dave ! org ! uk>
Date: 2004-03-29 20:46:40
Message-ID: 20040329204640.GA20330 () p15124614 ! pureserver ! info
[Download RAW message or body]
On Mon, Mar 29, 2004 at 03:11:00PM -0500, Moon, John wrote:
> Maybe...
>
> <snip>
>
> foreach (@array) {
>
> if (exists($counter{$_}) {
>
> $counter{$_} += 1;
>
> }
>
> else {
>
> $counter{$_} = 1;
>
> }
>
> }
>
> </snip>
All of which can be shortened to:
++$counter{$_} for @array;
Dave...
--
New .sigs
Running in please parse
--
The CGI-LIST is sponsored by:
www.DinnerBroker.com!
Fine dining up to 30% off!
Exclusive access to tables!
http://www.dinnerbroker.com/
To unusbcribe, send an email contining the words: 'unsubscribe cgi-list' to the \
following email address: majordomo@jann.com
Archives of the following mailing lists are available at: http://www.perl.jann.com/
the CGI Mailing List
the mod_perl mailing list
the embperl mailing list
Searching, browsing and posting are available at http://www.perl.jann.com/
No one may in any way attempt to data-mine or archive the
mailing list for financial gain without the express permission
of Jann.com.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic