Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Copy of multidimensional hash

by johngg (Abbot)
on Jan 03, 2013 at 09:02 UTC ( #1011422=note: print w/ replies, xml ) Need Help??


in reply to Copy of multidimensional hash

I believe it is because your %two hash contains as values references to the same anonymous arrays as are in %one. You would have to do something like (not tested)

my %two; foreach my $key ( keys %one ) { $two{ $key } = [ @{ $one{ $key } } ]; }

in order to create values which are new anonymous arrays containing the same contents as those in the original hash.

I hope this is helpful.

Cheers,

JohnGG


Comment on Re: Copy of multidimensional hash
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (18)
As of 2015-07-01 19:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (16 votes), past polls