BEGIN { use CGI::Carp qw(carpout); open(LOG, ">>/path/to/my/log") or die("Unable to open log: $!\n"); carpout(LOG); }