You can arrange for a callback to be run just before the "die" does its deed, by setting the $SIG{__DIE__} hook. The associated handler will be called with the error text and can change the error message, if it sees fit, by calling "die" again. See "$SIG{expr}" in perlvar for details on setting %SIG entries, and "eval BLOCK" for some examples. Although this feature was to be run only right before your program was to exit, this is not currently the case--the $SIG{__DIE__} hook is currently called even inside eval()ed blocks/strings!