# Map the data into cols parameter. my @rows = map { cols=>$_ } @{$datafromquery}; # Later $template->param(rows=>\@rows);