my $foo = $dbh->selectrow_array("SELECT cola FROM table WHERE id=$q->param('id')");
## This does not work.
## I could do something similar to this to solve the problem.
my $cgi_vars{id} = $q->param('id');
my $foo = $dbh->selectrow_array("SELECT cola FROM tablet WHERE id=$cgi_vars{id}");
####
foreach (keys %cgi_vars) { $q->param($_ => $cgi_vars{$_}); }
####
$template->param(
templatefoo => $q->param( 'foo' ),
templatebar => $q->param( 'bar' )
);