CGI scripts are programs written in Perl or any other language that output web content such as HTML pages
CGI scripts must output a Content-type header and a blank line before anything else
Debugging techniques for CGI:
Run the script from the command line
Try opening it in the browser
Check the logs
Various techniques are available for quoting text, including "here" documents and Perl quoting functions such as qq().
The %ENV special variable can be used to access environment variables via CGI scripts, including such variables as HTTP_USER_AGENT and HTTP_REFERER