in reply to Using STDERR and timestamps to write to a log file
$SIG{__DIE__} = sub {die log_error(shift) };#changed $_->shift $SIG{__WARN__} = sub {warn log_error(shift) }; [download]
Edited: Changed $_ to shift