Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Dynamic Memory allocation

by tirwhan (Abbot)
on Dec 15, 2005 at 10:24 UTC ( [id://516914]=note: print w/replies, xml ) Need Help??


in reply to Dynamic Memory allocation

if i delare array with my / local , they will get destroyed when the control comes out of the function in which the addition happens

This is wrong, Perl5 counts the references to a variable/data structure and only destroys the container if no more references are held. Since you are keeping a reference to your array in the the hash, the array will only be destroyed when your hash goes away (i.e. goes out of scope with no more references held to it) and is destroyed itself.


Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found