Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Best way to copy an array?

by jweed (Chaplain)
on Feb 22, 2004 at 06:22 UTC ( [id://330897]=note: print w/replies, xml ) Need Help??


in reply to Best way to copy an array?

For non-huge arrays, this should work fine:
@newlist = @{$self->{oldlist}};
This will copy the elements but not alias them: i.e., it will make 2 separate arrays that happen to start out with the same elements.



Code is (almost) always untested.
http://www.justicepoetic.net/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found