Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Best way to copy an array?

by jweed (Chaplain)
on Feb 22, 2004 at 06:22 UTC ( #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
Node Status?
node history
Node Type: note [id://330897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2018-11-13 18:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (158 votes). Check out past polls.

    Notices?