in reply to multidimensional hash value seems to become unitialized

You are doing a bunch of unusual things in your code. The one that realy jumps out at me is you keep taking a reference to a scalar, for example \$Tid in $Tids{\$Tid}{a}="----------";

You can try getting rid of the backslash, but I doubt that will solve your problem completely. Here is what I recommend: