Through Perl 4 Perl had neither lexical scope nor real references. It's scoping mechanisms were package namespaces and dynamic scope through local.
With Perl 5 both of those were added. But they needed backwards compatibility. Therefore they could not by default localize variables in subs, nor could they change local's behaviour. And since the working implementation all used the symbol table (and therefore gave the wrong semantics), a lot of reimplementation and fixing needed to happen. Plus some thought needed to be given to the semantic issues of having so many different (and incompatible) kinds of scope.
Which means that over the 5.* series you have seen constant extension of what can be lexical and how much it is used. For instance from 5.003 to 5.004 they added lexical loop variables, and 5.6 adds lexically scoped declarations of access to global variables.
Remember that Perl is still at its heart a hack written to avoid writing a real report generator that has gone seriously astray. :-)
In reply to RE (tilly) 3: Closures and scope
by tilly
in thread Closures and scope
by nop
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |