On Tue, Feb 19, 2013 at 10:37 PM, Rafael Garcia-Suarez <rgs@consttype.org>wrote: > No, it's not dynamic scoping: (I specified "for a definition of > scope..." because I'm aware of the weird lexical scoping rules applied > there) > > ~ยง perl -E'sub foo { say $1 || "nothing" } { "foo" =~ /(.)/ } foo' > nothing > That's outside of the dynamic scope, so as should be expected. Compare: ~$ perl -E'sub foo { say $1 || "nothing" } { "foo" =~ /(.)/; foo }' f This time the $1 is inside the dynamic scope of the bare block (and so see the localized $1), but outside of the lexical scope (and so could not have seen that $1, if it were lexically scoped). EirikThread Previous | Thread Next