http://www.perlmonks.org?node_id=307032


in reply to Knowing if an Operation is Successful in MySql

as taken from DBI module description:

$str = $h->state;
Returns an error code in the standard SQLSTATE five character format. Note that the specific success code 00000 is translated to '' (false). If the driver does not support SQLSTATE (and most don't), then state will return S1000 (General Error) for all errors.

you could also try $h->err; or $h->errstr;. just see the DBI documentation for more information.