You'll note that I didn't use the for my version. I feel that for $name should behave identically whether $name is a lexical or a global variable, as the same variable is visible outside the for block in both cases. The two variables live in two separate namespaces, which is the likely cause for the phenomenon we see, but as their visibility is identical, that shouldn't affect behaviour. The "localising" still shouldn't affect lexical variables in a way different to global variables, but it seems to do. This might warrant some mention in the documentation.
In reply to Re^4: How do closures and variable scope (my,our,local) interact in perl?
by Corion
in thread How do closures and variable scope (my,our,local) interact in perl?
by ELISHEVA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |