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}");