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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl 5.8 to 5.16 and HASH error
by robsgoingmad (Initiate) on Sep 12, 2012 at 08:15 UTC | |
by ig (Vicar) on Sep 12, 2012 at 20:00 UTC | |
by robsgoingmad (Initiate) on Sep 14, 2012 at 18:15 UTC |
In Section
Seekers of Perl Wisdom