Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: changing copy of a hash changes original

by 2teez (Vicar)
on Nov 13, 2014 at 18:25 UTC ( [id://1107138]=note: print w/replies, xml ) Need Help??


in reply to changing copy of a hash changes original

The sub fiddleHash is only supposed to alter hash2 but it also alters hash1

Since you use this my %hash2 = %hash1;, then do this

print %hash2; print %hash1;
Then you will see why!

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^2: changing copy of a hash changes original
by edo (Initiate) on Nov 13, 2014 at 18:44 UTC
    Many thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found