in reply to hash problems
use Data::Dumper; ... ... ... print Dumper(\%hash); [download]
always use Data::Dumper module to see what is in your hash
Or see How can I visualize my complex data structure?.
HTH,