my ($count) = $dbh->selectrow_array(" SELECT COUNT(*) FROM table WHERE col1 = 'xxx' "); print "Number of rows selected: $count\n";