$DBH->do("BEGIN"); # explicitly start a new transaction # this overrides autocommit setting # ... $DBH->do("COMMIT"); #end transaction, this is the "expensive part" timewise #### my $dbh=DBI->connect('dbi:...', 'user', 'pass', { RaiseError => 1, AutoCommit => 1, ... }); $dbh->begin_work(); # if this fails, you have tried to nest transactions. unless ( eval { change_some_stuff($dbh); change_more_stuff($dbh); $dbh->commit(); 1; } ) { warn "Rolling back because: $@"; eval { $dbh->rollback() }; } # At this point, either all changes or no changes have happened in the database.