On Tue, Feb 19, 2013 at 10:53:41PM +0100, Rafael Garcia-Suarez wrote: > On 19 February 2013 22:41, Jesse Luehrs <doy@tozt.net> wrote: > > On Tue, Feb 19, 2013 at 10:37:31PM +0100, Rafael Garcia-Suarez wrote: > > > This is still exactly dynamic scoping, as far as I can see. Compare: > > > > $ perl -E'sub foo { say $::foo } local $::foo = "f"; foo' > > f > > > > $ perl -E'sub foo { say $::foo || "nothing" } { local $::foo = "f" } foo' > > nothing > > I stand corrected. (Pretty sure the internals don't do a full > localisation though :) It's the "current successfully matched RE" (PL_curpm) which is localised and updated on each scope exit; $1 et al just act like tied vars (well, magic actually) that retrieve a string from the current pattern match - which includes (possibly a copy of) the original string plus capture index pairs. -- Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.Thread Previous | Thread Next