local $SIG{__DIE__} = sub { my $message = shift; system qq(echo "$message" >> log.err); }; [download]
In reply to how i capture a script error to a file ? by gabrielsousa