XP is just a number | |
PerlMonks |
Re: What is the purpose of local *_ = \my $a in File::Find?by ikegami (Patriarch) |
on May 11, 2018 at 20:18 UTC ( [id://1214403]=note: print w/replies, xml ) | Need Help?? |
local $_ could be used to localize $_, but that doesn't remove any magic associated with it on some versions of Perl.
local *_ would do the trick by forcing an entirely new $_ to be created, but that also gets rid of @_, %_, etc.
Assigning to a glob is weird, though. It only assigns to the relevant slot. So that means assigning a reference to a scalar to *_ only replaces $_
Any fresh scalar would have worked. Note that this aliases $_ to the scalar, but File::Find does not take advantage of that feature.
In Section
Seekers of Perl Wisdom
|
|