BEGIN { use CGI::Carp qw(carpout); open(LOG, ">mycgi-log.txt") or die "Unable to append to mycgi-log: $! "; carpout(*LOG); }