Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-11-20 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (284 votes). Check out past polls.

    Notices?