@loop_data and $loop_data are not the same. Use either:
or,my $loop_data=[ {Auction=>'Test1', ID=>'1'}, {Auction=>'Test2', ID=>'2'}, {Auction=>'Test3', ID=>'3'}, {Auction=>'Test4', ID=>'4'}, ]; $template->param(table1 => $loop_data);
my @loop_data=( {Auction=>'Test1', ID=>'1'}, {Auction=>'Test2', ID=>'2'}, {Auction=>'Test3', ID=>'3'}, {Auction=>'Test4', ID=>'4'}, ); $template->param(table1 => \@loop_data);
Update: Ref. The fetchall_answer!, your commented out code should work if $sth is properly derived from a DBI connection object. The form of get_event_info() makes me think that you are not hitting the database or preparing and executing the statement. You may be looking for
except that the rows do not appear as hashes in that call.my $arrayref = $dbi->selectall_arrayref("select statement from sql") $arrayref = convert_to_hashes( $arrayref); $template->param(table1 => $arrayref);
After Compline,
Zaxo
In reply to Re: By ref or by ..well..ref!
by Zaxo
in thread By ref or by ..well..ref!
by growlf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |