my $debug = 0; if($debug && $debug == 1) { OPEN(DEBUG,">>/home/path/logs/debug.txt") or die "Could not Open File for appending: $!"; } #### print DEBUG "Made it to line 3917 where There was an error ['" . $dbh->errstr . "'] in the insert\n" if DEBUG && $debug;