BEGIN { use CGI::Carp qw(carpout); open(LOG, ">>/home/username/cgi-bin/mycgi-log") or die("Unable to open mycgi-log: $!\n"); carpout(LOG); }