shadowline
CHMOD << Basics >> Scalar Data
Do you have your CHMOD set? If not, go back a page and do that first otherwise the rest of this will not work.

Creating a PERL file is the same as creating a text file. Open your text editor (such as Notepad) and save it with the extension of either .pl or some hosts require it to be .cgi to work. Either way, the coding is the same.

The first line of code (sometimes referred to the SHEBANG line) specifies the path to the PERL interpreter on the host. This path will vary from host to host, so be sure you get the right path from your host. Many hosts have a common one such as ...

#!/usr/bin/perl

NOTE : There is no semicolon at the end of this command line.

The next command line you need is something to tell the PERL that you are working with HTML (web pages). It sets the MIME type.

#!/usr/bin/perl
print "Content-type: text/html\n\n";

After those two lines, you are into the PERL coding part of it. Two very important parts to remember are comments and semi-colons.

Comment lines let you document your coding. This makes it much easier for editing later on if you have a small paragraph telling what this part of the coding is doing or how. Basically, it is a "notes" type thing. Comment lines start with the # symbol. There is no semi-colon at the end of a comment line.

#!/usr/bin/perl
print "Content-type: text/html\n\n";
# This is a comment. The program will not see this line.

Now, you may be wondering about the very first command line. It uses the same symbol, so in theory it would comment the PERL path out too. Well... don't worry about it. It won't comment out that one first line and it will find the PERL path. That first command line is "special".

The semi-colon ; is also a very important part of PERL. It states where each command ends. There are a few instances where it will not appear (such as the shebang and comment lines) but for the most part, they will appear at the end of each command line.

OK... Now you are ready go venture forth into the programming world of PERL!

BBBBBZZZZZZZ!!!!!!!
WRONG!

I would highly suggest going through each of the tutorial pages and learning the ins and outs of programming PERL. It is a great tool to use and if you've already learned JavaScript, most of this will be easy. So trudge on and learn it all :)
CHMOD << Basics >> Scalar Data
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow