Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Why is "for" much slower than "while"?

by Anonymous Monk
on Jan 15, 2010 at 13:20 UTC ( #817637=note: print w/replies, xml ) Need Help??


in reply to Why is "for" much slower than "while"?

context, while is scalar, for is list, and readline reads the whole file in list context
$ perl -MO=Deparse -e" ++$counts{$_} for <IN>; " ; ++$counts{$_} foreach (<IN>); -e syntax OK $ perl -MO=Deparse -e" ++$counts{$_} while <IN>; " ++$counts{$_} while defined($_ = <IN>); -e syntax OK

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://817637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2022-01-27 03:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?