use Fatal qw(open); eval { $dbh->do(...); open my $fd, "<", $file; # some other stuff } if($@) { # and here we can't say if it was DBI problem or open }