Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^5: How come @_ gets changed here?

by dave_the_m (Monsignor)
on Jun 10, 2017 at 19:04 UTC ( #1192487=note: print w/replies, xml ) Need Help??


in reply to Re^4: How come @_ gets changed here?
in thread How come @_ gets changed here?

the rough rule is: don't free elements of arrays and hashes (e.g. by assigning a list to the array or hash) when those elements are currently the arguments of a funtion call, or are being iterated over by for(), etc.

Dave.

Replies are listed 'Best First'.
Re^6: How come @_ gets changed here?
by LanX (Archbishop) on Jun 10, 2017 at 19:16 UTC
    Please correct me if I'm wrong, but as long as I copy the args in my first line, it should be safe from messed up ref counts, shouldn't it?

    my ($a, $b) = @_

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2019-07-22 10:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (14 votes). Check out past polls.

    Notices?