#!/bin/sh echo content-type: text/plain echo date #### #!/your/path/to/perl print "Content-type: text/plain\n\n"; print "Hello world at " . localtime() . "\n"; #### #!/your/path/to/perl BEGIN { print "Content-type: text/plain\n\n--OUTPUT--\n"; } ... rest of your script ... #### BEGIN { print "Content-type: text/plain\n\n--OUTPUT--\n"; open STDERR, ">&STDOUT"; # errors go to browser now } ... rest of your script ...