Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Just to add my 2 cents - it's important not to confuse
with as the former is an alias for foreach with the localization of the loop variable enabled (for the reasons that have been cited above), and the latter a straight loop counter similar in semantics as C's for() loop. This reminds me of being bitten by the following several years ago: A C programmer would think nothing of this loop. It's a straight do/while loop with a break (or its perl equivalent) statement, right? Wrong. last/next doesn't work in this situation, because it isn't really a do/while loop, but rather a do BLOCK with a post condition (the while($some_other_condition) could just as well have been an unless() or if()). Michael In reply to Re: for loop localisation bug?
by mpeppler
|
|