XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Update: This node is based on a mistake, the statements below are false. See Re: Re: Lexicals in if() scope gotcha!. I fell through this trap when I wrote something like this: and I got a warning for redefining $n. The difference is that as for localizes the looping variable (even if it's not my, but a global), it's just stupid to have it outside the loop's scope. It might be useful to access it after the loop when you're writing a for(;;) loop or an if() conditional. While this is a bit counter-intuitive for me too, it does have some logic. Perl is just not C++ (where you can put a declaration in the first argument of for(;;;)). In reply to Re: Lexicals in if() scope gotcha!
by ambrus
|
|