use strict; use warnings; use DBI; my $database = 'test'; my $dsn = "DBI:mysql:$database;mysql_read_default_file=$ENV{HOME}/.my.cnf"; my $dbh = DBI->connect($dsn,undef,undef,{ RaiseError => 1 }); $dbh->do("update foo set bar=1"); my $info = $dbh->{'mysql_info'}; my ( $matched, $changed, $warnings ) = $info =~ /Rows matched: (\d+) Changed: (\d+) Warnings: (\d+)/; print "Matched: $matched\nChanged: $changed\nWarnings: $warnings\n";