BEGIN { print "Content-type: text/plain\n\n--OUTPUT--\n"; open STDERR, ">&STDOUT"; # errors go to browser now } ... rest of your script ...