in reply to Tie-ing hashes clobbers data

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:

# Untested change!!! sub _read { # still need to deal with race conditions my $file = shift; return undef unless -f $file; our %data; unless (my $ret = do $file) { warn "couldn't parse $file: $@" if $@; warn "couldn't do $file: $!" unless defined $ret; } return \%data; }
That should work. :-)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.