in reply to Hash assignment "odd" ness
I guess line 25 is that line:
%hash = ($tmp); [download]
And that line meshes quite well with the diagnostic you got, and the explanation. What is this line supposed to do?