in reply to Re^2: Scope and references
in thread Scope and references
I never realized that a simple loop like this ... actually allocated and destroyed a new array every time through the loop. Since you go around the loop twice, it seems like you don't "leave" the scope in which @a was delcared, so @a should still "be there" during the second iteration. I still don't get that.
In for(...) { ... } the curly braces define a block. Each time the loop iterates you re-enter that block. And every time you enter a block, you enter a new scope.
That is just the way it is, and the way it is meant to be.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Scope and references
by {}think (Sexton) on Jun 19, 2011 at 18:44 UTC | |
|
Re^4: Scope and references
by {}think (Sexton) on Jun 22, 2011 at 02:33 UTC | |
by Anonymous Monk on Jun 23, 2011 at 13:05 UTC |