develooper Front page | perl.perl5.porters | Postings from January 2022

Re: Can't localize lexical variable $x at ...

Thread Previous | Thread Next
January 25, 2022 15:04
Re: Can't localize lexical variable $x at ...
Message ID:
On Tue, Jan 25, 2022 at 01:20:17PM +0000, wrote:
> I think of local() as "temporarily replace the value at this lvalue
> with a new value, restore it at the end of the current lexical scope".
> This is hugely useful in many situations that would otherwise require
> more and slower code with much more opportunity for error.

Out of curiosity, is there any reason not to simply shadow it: my $x = ...?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About