in reply to Re^2: Lexical closures
in thread Lexical closures
Yes! Thanks. I've never think about aliasing longer than the easy way to work on the elements of an array directly, that is the purpose, in most case, of the foreach loop.
But, I'm continuing playing with that and realize aliasing also implies narrowing the scope of the variable to the loop,
my $i = 123; foreach $i (0..3) { ; } print "$i\n"; # 123
No? If it does not narrow it itself the final value of $i should be 3.
If so, the funny thing is in "foreach my $i" my is not revelant as far we do not control in fact the scope of $i at this point. So, can we consider a bug, or at least an over sanity warn, the fact strict.pm forces us to put it here?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Lexical closures
by chromatic (Archbishop) on Oct 25, 2008 at 18:40 UTC | |
by backstab (Novice) on Oct 25, 2008 at 21:37 UTC | |
by ikegami (Patriarch) on Oct 25, 2008 at 22:33 UTC | |
|
Re^4: Lexical closures
by GrandFather (Saint) on Oct 25, 2008 at 19:48 UTC | |
by ig (Vicar) on Oct 26, 2008 at 01:37 UTC | |
by backstab (Novice) on Oct 25, 2008 at 20:45 UTC |