CGIs and Perl

Note: Indiana University students cannot install CGI scripts on the shared UCS systems (e.g., Silver, Nickel, Copper, or Bronze.
A CGI (Common Gateway Interface) program serves up information to the Web. For instance, WWW fill-out forms have CGI scripts running behind them to process the information from the form. Searchable databases are good examples of CGI scripts.

A CGI script is as simple to write as any other Perl script. The dearth of "how to write CGI scripts" information on the Web is due only to the fact that, since a CGI script can be written in any language, the answers vary from language to language. Well, here's One Way To Do It with Perl.

First off, here's our silly test form. Don't forget to read the source.

Now, here's the silly CGI script that runs behind it.

And here's a commented version of that CGI script.

Not much going on there, huh? The CGI is simple. Output just goes to the user's screen, as a page on their web browser. Here's all the important information:

To trouble-shoot a CGI script, you can run it from the command line. If html gets spit out on your screen, well, you probably did it right, then.
Here's all the 'net resources you might need, gleaned from tecfa's fabulous WWW Resources page: ...and maybe...
This Beginner's Guide to Perl is authored and maintained by scotty@bluemarble.net.