Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Don't local(@_)

by hossman (Prior)
on Jan 13, 2002 at 06:50 UTC ( [id://138381]=note: print w/replies, xml ) Need Help??

in reply to Don't local(@_)

This definitely strikes me as a bug. Per Programming Perl...
If you have a local that looks like this:
{ local $var = $newvalue; some_func(); ... }
you can think of it purely in terms of run-time assignments:
{ $oldvalue = $var; $var = $newvalue; some_func(); ... } continue { $var = $oldvalue; }
The difference is that with local the value is restored no matter how you exit the block, even if you prematurely return from that scope.

Regardless of or what variable you are local'ing in your sub, it should return it to it's orriginal value on exit -- and it certainly shouldn't affect the callers scope.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://138381]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-06-22 23:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.