This document was written by CS 290W TA David Corcoran and was last modified 01/04/1999 04:14:58
Your Perl programs will be run as APPLICATIONS, not as APPLETS. They can be in your www folder (or some sub-folder) of that. You can create them anywhere and ftp them to your career account.You can name your Perl script anything you want. It is common to add the extension .pl to your Perl file. So your first Perl program might be named helloworld.pl. You will also need to issue the following command to tell the operating system that this script is executable.
A Perl script must know where to find the Perl interpreter. To do this, it is necessary to include one line at the beginning of every program you write in Perl.
Our first Perl program, the notorious "Hello, World", will only require two lines of code:
You will also notice the print function. This function does exactly what it says it is doing. It prints the text following it in quotes. The \n tells it to start a new line when it is finished printing that line.
Each line of code in Perl (but not the first line which is information to the operating system) is ended with a semicolon. You should be used to this notation from JavaScript and Java.