open(LOG, ">>/usr/local/cgi-logs/mycgi-log") or do { my $error = "Unable to open mycgi-log: $!\n"; print "Content-Type: text/plain\n\n", $error; # to the screen die $error; # & the logs };