|
|
| P is for Practical | |
| PerlMonks |
Re^2: What's wrong with this local() ? (*)by tye (Cardinal) |
| on Jan 30, 2008 at 08:14 UTC ( #665082=note: print w/ replies, xml ) | Need Help?? |
|
Actually, it is closer to:
That is, it is not just the value that is saved, but the scalar that holds that value. This can matter if the variable was tied or has other "magic" attached to it. It also matters if you have taken a reference to the original instance of the variable or take a reference to the new instance (they will point to different variables). It also means that the string value is not copied, as would happen with $saved= $var;. - tye * Actually, this step is less like *var= \undef; (which leaves $var read-only) and perhaps more like *var= do { my $t= undef; \$t };. But testing shows that the latter leaves $var marked "PADBUSY" and "PADMY" so it is perhaps even more like *var= \[undef]->[0];. Go figure. :)
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||