in reply to Lexical scope vs. postfix loops (perl bug?)
Using statement modifiers on a my declaration results in undefined behaviour. So the answer is "don't do that" ;-) (see perlsyn)
"Undefined" means, as always, that anything can happen. The "do { my $x = ... } for (1 .. 3)" version is not such a case (the modifier is on do, not my), so that's why it behaves reasonably.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Lexical scope vs. postfix loops (perl bug?)
by jh (Beadle) on Aug 25, 2008 at 20:27 UTC | |
by ikegami (Patriarch) on Aug 25, 2008 at 22:13 UTC | |
by moritz (Cardinal) on Aug 25, 2008 at 20:36 UTC | |
by jethro (Monsignor) on Aug 25, 2008 at 20:47 UTC | |
by moritz (Cardinal) on Aug 25, 2008 at 21:03 UTC | |
by jh (Beadle) on Aug 25, 2008 at 21:13 UTC | |
| |
by JadeNB (Chaplain) on Aug 26, 2008 at 16:31 UTC | |
by moritz (Cardinal) on Aug 26, 2008 at 16:49 UTC |