print LOG "Some message like, \$v=$v\n" if DEBUGING; #### do this or die "couldn't do it."; #### $SIG{__DIE__}=sub {print LOG "Script Died" and close LOG if DEBUGING}; # is what I have, but I want: $SIG{__DIE__}=sub {print LOG "Script Died: $msg" and close LOG if DEBUGING};