my $data = qq[SELECT COUNT(*) FROM questions WHERE `q1` = "handheld"]; my $sth = $dbh->prepare($data); $sth->execute() or die $sth->errstr; my $results = $sth->fetchrow_array(); print $results;