in reply to What about if (my $var = foo()) { ... }
I've just found some code on my scratchpad which shows that apart from postfix modifiers, there's at least one other way where scoping rules get crazy. The following code behaves differently on perl 5.10.0 from 5.8.8.
perl -we '@a = qw"a b"; while (my $x = pop @a) { push @x, \$x; print \ +$x, ": ", ($x || 0), "\n"; redo if 0 != @x % 3; }; '
Note: I don't understand what happens in either case. I don't even really understand the simple my $x if 0 case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What about if (my $var = foo()) { ... }
by Anonymous Monk on Jul 19, 2008 at 10:07 UTC |