in reply to Perl and MySQL: Get number of rows affected

In addition to the obvious route of issuing another query with a COUNT(*), you can also use a MySQL-specific trick for this. If you run this SQL:
SELECT SQL_CALC_FOUND_ROWS value FROM table WHERE distinguishing_value + = ?
then you can run this query afterward to get the count without actually accessing the tables again:
SELECT FOUND_ROWS()
This is documented here.