A simple way to get the number of rows your query has returned (using Perl & mySQL) is to use my $count = $sth->rows; Or just print "$sth->rows";