in reply to Re: 'local' for imported variables doesn't work as expected (4 updates)
in thread 'local' for imported variables doesn't work as expected
It's localizing the symbol NOT the referenced variable.
Otherwise it would be possible to localize lexical variables too.
Demo in the debugger
DB<13> my $x = 42; *b = \$x; {local $b= 666; say "$b = $x"}; say "$b = + $x" 666 = 42 42 = 42
Now exporting typeglobs works because the scalar slot is one level deeper, hence local will operate on the same slot
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
|
|---|