in reply to Perl 5.8 to 5.16 and HASH error
When I am dealing with non-trivial data structures and when variables seem not to have the values I expect or need, I often use Data::Dumper to print the variables and see what I am dealing with. I might print to a log file but often find it sufficient to terminate the program with something like:
use Data::Dumper; ... die Dumper($Xml); foreach $key (keys %{$Xml->{data}}){ $sql1.="`$key`,";$sql2.="`$key`=?,";$sql3.='?,'; }
You know that either $Xml or $Xml->{data} is not a hash reference, from the error message. I would first want to know what it is. Then I would decide whether to change the preceding code to set it to what the following code requires, or change the following code to handle what it is.
In Section
Seekers of Perl Wisdom