Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: How to preserve values outside a subby RMGir (Prior) |
on Oct 25, 2017 at 15:52 UTC ( [id://1202016]=note: print w/replies, xml ) | Need Help?? |
That's the way references work - what you're passing to your 'pass1' function is a pointer to the hash '$hashref' points to, not a copy of it, so local changes get applied to that global copy.
If you want to pass a local copy, specify that:
If you do that, then you get: which is what I think you expect. Added (shallow) note, AnomalousMonk is correct in his reply below! Mike
In Section
Seekers of Perl Wisdom
|
|