my $arrayref = $dbi->selectall_arrayref("select statement from sql") $arrayref = convert_to_hashes( $arrayref); $template->param(table1 => $arrayref);