in reply to Re: How to get an acceptable H::T AoH ref
in thread How to get an acceptable H::T AoH ref
Okay, I'm baffled. When I go back and look at an AoH that *does* works with an H::T loop, and Dump it, I get something like:
my $allshows = $sth->fetchall_arrayref({}) }; print Dumper($allshows); $VAR1 = [{ 'title' => 'All Bets Are Off', 'type' => '2', 'number' => '215', 'id' => '1' }, { 'title' => 'Who Is My Neighbor', 'type' => '2', 'number' => '217', 'id' => '2' }];
Which matches up with the H::T documentation. When I go back to my original code:
push @$allshows, $sth->fetchall_arrayref({}); ... print Dumper(@$allshows); $VAR1 = [{ 'title' => 'All Bets Are Off', 'type' => '2', 'number' => '215', 'id' => '1' }]; $VAR2 = [{ 'title' => 'Who Is My Neighbor', 'type' => '2', 'number' => '217', 'id' => '2' }];
But when I try dragonchild's I get:
... push @$allshows, @{ $sth->fetchall_arrayref({}) }; ... print Dumper(@$allshows); $VAR1 = { 'title' => 'All Bets Are Off', 'type' => '2', 'number' => '215', 'id' => '1' }; $VAR2 = { 'title' => 'Who Is My Neighbor', 'type' => '2', 'number' => '217', 'id' => '2' };
Seems like I just need to append the single element of the array with hashes. With this I get no error, but no data either:
... $allshows[0] .= $sth->fetchall_arrayref({}); ... print Dumper(\@allshows); $VAR1 = [ 'ARRAY(0x83db738)ARRAY(0x843ef94)' ];
It seems I'm close, but no cigar. What am I missing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to get an acceptable H::T AoH ref
by dragonchild (Archbishop) on Sep 11, 2004 at 02:24 UTC | |
by bradcathey (Prior) on Sep 11, 2004 at 14:51 UTC | |
by dragonchild (Archbishop) on Sep 11, 2004 at 22:22 UTC |