Common Gateway Interface or more commonly known as CGI is a useful tool for enhancing web sites. It can be used on-line for many things particularly enhancing user interactivity and obtaining information from the user. Most CGI scripts are written in a programming language called Perl. Perl is the most common of the two languages used to program CGI - the other being C. In order to distinguish these two lauguages, the easiest way is to determine the file extension where a Perl file has *.pl or *.CGI. On the other hand, a C script has *.c which needs to be compiled on the server before it can be used whereas Perl is simply a scripting language which can be run without compilation.

$variable?

In the script, you will see  in this primer that most things you need to fill out will look like this...

$variable = "line";

What this means is somewhere in the script it requires you to tell the script what to do. For instance, if you were to have a program that prints your name, it would ask you this...

                   $myname = "Ah Beng";

               And somewhere in the script will be the line...

                   print "Hello! My name is $myname\n";

               See how the scripts see "Hello! My name is $myname" but it also sees that $myname
               equals "Bob Smith" (do not worry about "\n").

                   Path and URL

               CGI often asks you to specify the path or URL to an HTML or another CGI page.
               It is important to distinguish between these two.

               A path is directly relative to the current document. This is the path allocated by
               your server. For example, a path will look something like...

                   /usr/www/docs/someone/

               A URL (Uniform Resource Locator), on the other hand, looks like...

                  http://www.webpedia.com/cgi-bin/perl.cgi
 

home