$filename = substr($filename,0,-4); my $sth = $cbh->prepare("SELECT id, title, summary FROM resource WHERE id =?"); $sth->execute($filename); while (my $ref = $sth->fetchrow_hashref()){ my $title = $ref->{title}; my $id = $ref->{id}; push @rows, { ID => $id, TITLE => $title }; } } } my $template = HTML::Template->new(filename => 'ee_search.tmpl'); $template->param(SEARCH_STRING => $search); $template->param(ROWS => \@rows);