NOTES FROM THE FIRST CLASS ON PERL. (Contributed by a student -- thanks! -- and very slightly edited.) Unlike LISP, Perl has no shell. So you need to write your code in a file using emacs first and then run the file from the UNIX prompt. Here's how to create the Hello World code. #!/usr/local/bin/perl use English; print "Hello world.\n"; The first line indicates where Perl is located on the system. The second is intended to avoid certain problems in syntax, but I kind of forgot which problems Philip mentioned in class. At any rate, these two lines must be always present in your code. Then the third line is easy to understand, except for the \n thing. This means that after printing Hello World, start a new line. If you don't add this to your code the UNIX prompt will appear immediately after the Hello World phrase. Try the code with and without the \n and you'll see the difference. Notice that each function ends with a (;). This is essential to get the program running. Don't forget the semicolon. Also, unlike LISP, Perl is sensitive to the uppercase-lowercase distinction. So, be careful with that. To run this program, you need to do two things: First change the mode of the file into execution by typing "chmod u+x" followed by the name of the file, e.g. % chmod u+x hello.pl Second, you need to type the name of the file at the UNIX prompt like this: % hello.pl Notice that Perl files should be used with a .pl extension. This helps to get emacs in the Perl mode. In Perl, different variables are identified by different characteristic symbols. We talked about two main data types: scalars (e.g. numbers and strings) and arrays (which are lists). Scalars have to be introduced by $. For example: $mystring = 'Hello'; $x = 5; Arrays are introduced by @. For example: @days = ("Sunday", "Monday", "Tuesday"): To access an item on the array you use this: $days[ ]; And between the square brackets you type the number of the element you want to get. Notice that numbering here starts from zero. So to get the first element you use 0, to get the second use 1, etc.