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 ( #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 shadows deepen...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-07-22 20:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (455 votes). Check out past polls.

    Notices?