The stupid question is the question not asked | |
PerlMonks |
Re: Global variable unexpectedly modified when passed by referenceby wee (Scribe) |
on Dec 10, 2014 at 23:00 UTC ( [id://1109979]=note: print w/replies, xml ) | Need Help?? |
The global %hash is being altered because you are making alterations to its reference. What you want to do is dereference it in mysub(), like so: You can do whatever you want to %new_hash and nothing will happen to %hash.
In Section
Seekers of Perl Wisdom
|
|