Perl 101: Review
Review
Perl 101
To review what we have learned, lets start again, briefly, at the beginning. We learned how to FTP a program to the server and how to set the appropriate permissions. We learned that the first line of our program needs to point to the location of the Perl interpreter. We learned what a comment is, how to use them, and the correct syntax (Start a line with # followed by your comment). We learned about scalar variables, their syntax, and how to correctly edit them. We learned the difference between server paths and URLs. We learned that a subroutine is a block of code that completes a specific task when called. The correct syntax would be something like this:
&GetDrink # Call Subroutine
sub GetDrink { #The Actual subroutine
print "I am thirsty";
} #End subroutine
Every time we called the subroutine now in our program we would print the line "I am thirsty." We learned about query strings and simple pattern matching in Perl.
if ($something =~ /exec/i) #matches for a non case
sensitive regular
expression containing the
# letters exec.
if($something_else eq "exec") #matches strictly for the word exec, case sensitive
We learned how to open and close a file using a file handle, and the three ways to modify the file:
open(FILE1,"$FileName"); # Opens as
read-only
open(FILE2,">>$FileName"); # Opens for appending
open(FILE3,">$FileName"); # Opens for writing (deleting
previous contents)
It would be relatively simple to write a program that would parse our text file and tell us each users progression through the Web site. It would also tell us how long they spent on each page and what kind of browser they were using. It would function as a limited statistics package collecting some very useful information. If nothing else, remember that its a "Perl-fect" world!
Comments are welcome
Revised: May 8, 1998
URL: https://webreference.com/programming/perl/101/review.html