eval { my $dbh=DBI->connect("dbi:ODBC:$DSN",'USER','PASSWORD',{ RaiseError => 1, AutoCommit => 1, PrintError => 0 } ); # More database stuff create statements, execute }; if ($@) { print LOG $@; exit; } print LOG "Good\n";