Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Tie-ing hashes clobbers databy dragonchild (Archbishop) |
on Apr 08, 2002 at 15:22 UTC ( [id://157459]=note: print w/replies, xml ) | Need Help?? |
Your problem is very simple. All I had to do was look for the one place you have 'no strict' and dig.
You're constantly setting (and re-setting) a global variable called %data. Since you give a reference to this back to your TIEHASH function, any time you write into (or over) %data, that will appear in every single instance of this TIEHASH you have. Now, a good solution would be to not return a reference, but return a hash. Then, take a reference to the copied hash (which is now not called %data), and you're fine. A better solution would be this: That should work. :-) ------ Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
In Section
Seekers of Perl Wisdom
|
|