{ local $/; open SQLFILE, "< file.sql" or die "Can't open file.sql: $!"; $stmts = ; close SQLFILE; } eval { # Turn off autocommit, keep from dying on erros (but print them) $dbh{AutoCommit} => 0; $dbh{RaiseError} => 0; $dbh{PrintError} => 1; $dbh->do($stmts); $dbh->commit; }; if ($@) { print "Error: $@\n $DBI::errstr\n"; $dbh->rollback; }