For your Perl work in this course, you will need two directories. Create a directory within your
memberssubdirectory and name it
cgi-bin. Put your CGI scripts there, once you have debugged the basic Perl code. While you are working on the Perl code, use a different directory, such as
perl, for those versions of your programs and then move each one into your cgi-bin directory for CGI and HTML testing and actual use. You may also (or instead of) need to add a
.cgisuffix to the filename. Check with your instructor for the conventions to be used in your particular computing environment.
Each time you create a new Perl program, you must make it executable. In UNIX, you do this using the
chmod +x filenamecommand.
Your Perl program begins with an invocation of the Perl interpreter in the first line. By convention, the line begins with a hash or pound character (#), followed by an exclamation point (!), followed by the path to the interpreter.
Comments may appear anywhere on a line following a hash (#) symbol.
Perl statements end with a semicolon (;), and whitespace (spaces, tabs, etc.) may be used freely.
Perl programs do not require an end mark or end statement (other than the end of file for the program, itself).
The following is a null Perl program that is valid within the author's environment:#!/usr/local/bin/perl # a comment ; # a null statement
for practice, type it into a file, make it executable, and run it.