in reply to DBI: Better way to find number of rows in a table?

Nothing wrong with your code - it gets the job done, it's easy to understand - it's not that big. "jeffa" had a good example using the perl "grep" function, but I find those long one or two liners harder to understand than something simple (with a few more lines) like you've done here.

As "jeffa" (I think) pointed out, you could probably shorten your code by replacing the prepare, execute, and fetch with a selectrow_arrayref - from 'perldoc DBI':
"selectrow_arrayref" $ary_ref = $dbh->selectrow_arrayref($statement); $ary_ref = $dbh->selectrow_arrayref($statement, \%attr); $ary_ref = $dbh->selectrow_arrayref($statement, \%attr, @ +bind_values); This utility method combines "prepare", "execute" and "fetchrow_arrayref" into a single call. It returns the firs +t row of data from the statement. The $statement parameter can be a + previ- ously prepared statement handle, in which case the "prepare +" is skipped. + If any method fails, and "RaiseError" is not set, "selectro +w_array" will return undef.
HTH.