in reply to Are we seeing syntax inconsistency?
Yes. $_ is a package variable. $index is a lexical. In the first case, you have a closure which closes over $index; in the second, you simply have an anonymous function that prints a global variable.
I do find it curious that you get 11 different $index variables, though; I would expect you’d get only one. I’m not entirely sure of how foreach works in this respect.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Are we seeing syntax inconsistency?
by Ovid (Cardinal) on Nov 11, 2005 at 05:11 UTC | |
by Animator (Hermit) on Nov 11, 2005 at 16:37 UTC | |
by Aristotle (Chancellor) on Nov 11, 2005 at 17:11 UTC |