Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Copy of multidimensional hash

by davido (Archbishop)
on Jan 03, 2013 at 08:57 UTC ( #1011420=note: print w/replies, xml ) Need Help??


in reply to Copy of multidimensional hash

Multi-dimensional data structures in Perl use references. Each of your hash keys indexes a value. That value is a reference to an anonymous array. When you copy the hashes, the new one still holds the same references, to the same anonymous arrays.

You want to look at Storable's dclone() function: It makes a deep recursive copy of the values rather than a shallow copy of the references.


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011420]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2017-11-25 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (355 votes). Check out past polls.

    Notices?