develooper Front page | perl.perl5.porters | Postings from March 2013

Re: Perlfunc for each(), keys(), values() has been changed

Thread Previous | Thread Next
From:
Uri Guttman
Date:
March 29, 2013 18:05
Subject:
Re: Perlfunc for each(), keys(), values() has been changed
Message ID:
5155D7FD.8030104@stemsystems.com
On 03/29/2013 01:46 PM, demerphq wrote:

> ps: Dont worry, i have no plan of making keys annoying to use, but if
> I can I would like to make for (keys %hash) as fast as possible!
>

what is wrong with?

	while( my $key = each %hash )

same effect as the optimized foreach loop other than using a named var 
(which i would do with foreach anyway).

now i usually do each with a key/val pair and then the empty list will 
be the boolean stop. the while $key needs a defined as '' or '0' are 
legal keys but false. still no reason to add an optimized for keys.

uri



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About