$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};