my $dbh; eval { $dbh = DBI->connect("dbi:SQLite:dbname=request_db","","", {RaiseErr +or => 1}); $dbh->do($createTableSQL); }; if ($@) { # handle error here # the error will be in the $@ variable # the error raised could be from the connect or the do methods }