my $rowCount = $dbh->selectrow_array(


                                      SELECT count(*)

                                         FROM my_table

                                       WHERE attr1 = ?
In theory it's a bad thing to assume a select will return a single scalar value instead of multiple attributes and rows, however with a count clause we should be pretty safe. N.B. using the $dbh->rows() function or similar is not correct on a select statement. Modified after a suggestion from Randal. Thanks mate.