in reply to Re: Hash assignment "odd" ness
in thread Hash assignment "odd" ness
Thank you!
"list" was my disconnect. I tried the direct assignment construct multiple times, before I tried building the string and, every time Dumper out put would look like:
$VAR1 = 'Comments'; $VAR2 = ''; $VAR3 = 'InstallAddID'; $VAR4 = ''; . . .
When what I was expecting was:
Comments = ''; InstallAddID = '';
So the "X" is "%hash = ($never_gonna_work)" and the "Y" is "Why doesn't Dumper read my mind."
print Dumper(\$po); would have solved my problem.<\p>
Thanks again for the clarity. And this now works.
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Data::Dumper; use DBI; my $dbargs = {AutoCommit => 0,PrintError => 1}; my $dbc = DBI->connect("dbi:SQLite:dbname=da_hrb.db","","",$dbargs); # get the default po my $sth = $dbc->prepare('select * from der_po where poid = 0'); $sth->execute; my $po = $sth->fetchrow_hashref; # corrected. thanks ikegami print Dumper($po);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Hash assignment "odd" ness
by ikegami (Patriarch) on Jun 30, 2010 at 06:41 UTC | |
by phigment (Initiate) on Jun 30, 2010 at 07:23 UTC |