in reply to Strange problems with Tie

open(TEST, ">> fields_data");
*grumble* Always check the rsult of system calls...moving on.

The keys in the hash are not what you think they are. If print "$foo{$key}" says one thing, but later on $key="X", $val=$foo{$key} says another, then you're $key's aren't the same in both places. Simple as that. (or the DBM is whacked.)

In your diagnostics, put some quotemarks around the keys as you print them. Check for unprintables too.