Beruflich Dokumente
Kultur Dokumente
Aaron Weiss April 26, 1999 Perl - the very thought evokes a heady, adrenaline rush in the hearts of hard-core hackers, and an intimidating sense of anxiety in practically everyone else. The good news is that you don't need to master Perl to make it useful: Perl is simply a hammer, with which you can build a birdhouse or a mansion. nd you don't need to be !ob "illa to build a birdhouse. #n this article we begin a series on using Perl in web development scenarios. To start, we ease in with a general introduction to Perl itself. $uture articles will take more in-depth looks at #nternet capabilities you can leverage from within Perl programs. This article assumes Perl % as the reference version of Perl. &evelopers who have some familiarity with any other programming language, from ! '#( to Pascal to ( to )ava'cript, will benefit the most from this article* however, readers with no programming background can still follow along and pick up most of the concepts.
"A minute to learn, a lifetime to master" is the slogan for the board game Othello, but it might just as well belong to Perl. Put more accurately, the basic concepts behind Perl are simple to understand, especially for developers familiar with other programming languages. Yet, the open-ended fle ibility of Perl offers seemingly endless possibilities -- which is where the e hilaration and!or intimidation usually sets in. "he good news is that you don't need to master Perl to ma#e it useful. $eb developers ta#e heart% Perl is simply a hammer, with which you can build a birdhouse or a mansion. And you don&t need to be 'ob (illa to build a) birdhouse. *n this article we begin a series on using Perl in web development scenarios. "o start, we ease in with a general introduction to Perl itself. "he purpose of this introduction is not to send you off writing enormous Perl programs -- there are plenty of articles and boo#s which already succeed at this. +ather, this tutorial should arm you with a basic understanding of Perl so that you can wor# through the e amples you care about -- web interaction -- without first needing to become a Perl guru. ,uture articles will ta#e more in-depth loo#s at *nternet capabilities you can leverage from within Perl programs. "his article assumes Perl - as the reference version of Perl, which has supplanted the popular but older Perl . by several years now. /evelopers who have some familiarity with practically any other programming language, from 'A0*1 to Pascal to 1 to 2ava0cript, will benefit the most from this article3 however, readers with no programming bac#ground can still follow along and pic# up most of the concepts by inference.
Contents:
+ho's fraid of Perl, -etting Perl .unning Perl Programs Perl "ariables: 'calars Table /. !asic Perl 0perators Perl "ariables: (omparing 'calars Table 1. Perl (omparison 0perators Perl "ariables: 2ists 3aka rrays4 Perl "ariables: 5ashes Perl $unctions Perl Program $low: (onditionals and 2oops (onclusion
4any Perl practitioners are 5ealots for the cause -- Perl has evolved into a near-religion for many programmers. "he great advantage of this is that there are many fol#s out there who sincerely believe in the language and wor# hard on its behalf in continued support and development. "he disadvantage of this 5ealotry is a somewhat 6are 7rishna-es8ue style of evangelism which may intimidate many newcomers. Perl "mongers", as they li#e to be #nown, find great pleasure in ma imi5ing their use of this tool, which often comes out in the form of incredibly cryptic Perl programs which pac# e treme amounts of processing into small amounts of code. A typical Perl monger, for e ample, will while away the better portion of a wee#end in a dar#ened room and proudly produce the following gem%
Getting Perl
UNIX
Of course, before you can write Perl programs, you&ll need Perl itself. You may already have access to Perl depending on the type of system on which you develop. *f you develop on a ;ni system, such as 0olaris, 0unO0, @inu , any '0/ variant, or the many others, the chances are good that Perl is already installed. You can test this hypothesis 8uite simply -- login to your shell account >usually by telnet? and type%
perl -v
"he output will loo# something li#e%
This is perl, version 5.004_04 built for i386-linux (with 1 registered patch, see perl -V for more detail) Copyright 1987-1998, Larry Wall
As you can see, this sample machine has Perl -.AA.-A. installed. You do want to be sure that your ;B*C system has at least a Perl version of -. 3 the previous version of Perl, .. , may still be installed on many systems. You don&t want to use Perl . because it is old and unfashionable. A number of ;B*C systems have both Perl . and Perl - installed. You may find that "perl" leads to Perl . but the command "perl-" leads to Perl -. "hus, if "perl -v" failed you with a .. version, you might try%
perl5 -v
And see if that reports a -. version of Perl. *f yes, then you should remember that your system refers to Perl - as "perl-" rather than simply "perl" -- this will be necessary to #now later on. *f, for some odd reason, your ;B*C system does not already have Perl installed, you will have to ac8uire Perl and have it installed. "he installation would be done by the system administrator, if that is not yourself. *f that is yourself, you can sometimes obtain ready-made binaries for various ;B*C systems from your vendor >for instance, users of .ed5at 2inux can install the Perl +P4 available on either the +ed6at 1/ or $eb site?. "he brave and courageous can also compile Perl from the source code, available from the Perl.com web site.
WINDOWS
Perl happily runs on other systems besides ;B*C9 *f you develop in $indows, or would li#e to develop Perl programs in both $indows and ;B*C environments, you can easily install the latest version of Perl. Active0tate maintains a $indows version of Perl which is 8uite easy to install, named ctivePerl.
MACOS
/espite its command-line heritage, Perl has even made it ashore on the 4acintosh. Bot that there&s anything wrong with that. A variety of resources for the 4acPerl project can be found the 6acPerl % site.
"ypically, you&ll see that many Perl programs found on the net or in tutorials begin with the line%
#!/usr/bin/perl
"he above line is actually intended for ;B*C systems -- other operating systems will simply ignore it. 6owever, because ;B*C is typically considered the de facto platform for Perl, many Perl programs include this line. *t tells ;B*C where to find the Perl program3 the path /usr/bin/perl is a common location for ;B*C-based Perl installations. *f you are wor#ing in a ;B*C environment, it is important that this first line point to the correct location for Perl on your particular system3 alternatives may loo# li#e, for e ample%
#!/usr/local/bin/perl #!/usr/bin/perl5
*n either ;B*C or $indows, if the perl program is in your search path you can also run a Perl program simply with the command line%
perl programName
$indows users might also use associations to run Perl scripts. $indows associations assign a particular program to run when a filename with a particular e tension is launched. "hus, you can associate the perl e ecutable with filenames ending, for e ample, in .plx or .pl. Active0tate&s Perl installation will setup such an association for you. You can then launch Perl programs by simply double-clic#ing them from the des#top. 7eep in mind that for $eb developers, many Perl programs will be launched in the conte t of 1<*. $e&ll tal# more about 1<* later, but for now you should understand that using Perl programs for 1<* involves a combination of the $eb server&s configuration and the above methods of launching Perl programs.
$exRate
$e could simply assign a value to e +ate%
$exRate=1.35;
$e could create another variable, E;0"otal, to represent a dollar amount in American currency, then calculate the value of a resulting variable, E1/B"otal, and output the results.
#!/usr/bin/perl $exRate=1.35; $USTotal=50.00; $CDNTotal=$USTotal*$exRate; print "$USTotal American dollars is equivalent ". "to $CDNTotal Canadian dollars.\n";
"his simple program assigns values to two variables, and in the third line operates on them while assigning the results of that operation to a third variable. "he operator used here is multiplication, represented by the asteris# >F?, a typical operator in programming languages. Botice that the scalar variable names appear within the double-8uoted output string -this may appear unusual to those familiar with other programming languages, but Perl recogni5es that E;0"otal and E1/B"otal are variable names and it substitutes their values in the output. "he resulting output of the above program would loo# li#e%
7ote the way the output strings have been broken up into multiple segments. lthough we could have simply typed one long line, it would have been difficult to read within this article. To make the line more legible, the output string has been broken into portions, with a concatenation operator, the 8.8,between each portion. The result is exactly the same as if we typed one long line.
$CDNTotal=$USTotal*$exRate;
"here are two operations here% the multiplication operator, represented by the asteris# >F?, multiplies the value of E;0"otal by the value of Ee +ate. "he assignment operator, represented by the e8ual sign >L?, assigns the result of the multiplication operation to the variable E1/B"otal. +emember previously we opined that Perl uses its intelligence to infer the type of value a variable contains. ,or instance, when you multiply two variables, this operation only ma#es sense if the two variables contain numeric values. You can&t, after all, multiply the value "chic#en" by the value "eggs". "hus, when you use an arithmetic operator, Perl tries its hardest to use the variable&s values as numbers. 0ome operators, though, are not arithmetic. ,or e ample, consider the string concatenation operator, represented by the dot character >.?. 0tring concatenation is the result of s8uishing together two string values3 for instance%
"hello" . "goodbye"
yields
"hellogoodbye"
6ere we come to the important point% if you use an arithmetic operator on two values which can be seen as numbers, Perl will perform the arithmetic. *f you use a string operator on the two values, Perl will treat the values as strings. "hus%
5 + 10 5 . 10
yields yields
15 "510"
Table "# $asi! Perl %&erators Operator M F ! Bame addition subtraction /escription 'ums values together. 'ubtracts right value from left value. &ivides left value by right value. .emainder of dividing left value by right value. .aises the left value to the power of the right value. = ample 19:;9 19-/9 19<;9 19>% 19>; 19<<1 8hot8.8dog8 8hot 8.8dog8 %9 /9 =99 ? 1 20 divided by 3 yields 6 (6*3=18) with a re ainder o! 2 (20"18)# ?99 $%&ivalent to 20*20 8hotdog8 8hot dog8 +esult
FF .
string (hains together the concatenation characters in each value. string replicate .epeats the characters in left value the right value number of times.
yields yields
false true
"ypically, you would include one of these comparisons inside a larger e pression, which ma#es use of the result. A simple e ample would be an assignment to a third variable%
$USgreater=($USTotal>$CDNTotal);
*n a later line of code you might test whether E;0greater contained true or false, as a result of the above comparison. 4ore commonly, though, these types of comparisons are used in conditional statements to direct the flow of the Perl program. $e haven&t yet loo#ed at conditional statements, but they should be 8uite familiar to readers with basic programming e perience. Bon-programmers can simply read the e ample aloud to get an idea of the logic behind this code%
if ($USTotal>$CDNTotal) { ...execute some piece of code... } else { ...execute some other piece of code... }
Bow suppose that we wanted to test whether E;0"otal and E1/B"otal were e8ual. ;sing the arithmetic e8uality operator, a double e8ual sign >LL?%
$USTotal == $CDNTotal
yields
false
Of course, if both E;0"otal and E1/B"otal contained the same value, the result of this e8uality comparison would have been true. Programmers note: the arithmetic comparison operator is a double equal sign, not just one. Several other programming languages use a single equal sign to represent both the comparison operator and the assignment operator, and forgetting to use the double equal sign is a common cause of program errors in Perl scripts . +ecall our earlier discussion about data types, and how Perl infers the data type based on the operator being used. *n the above e ample, we are comparing whether one value is greater than another -- this only ma#es sense with numbers, since we cannot say that "dog" is greater than "cat" >well, some might say that, but they would be as#ing for trouble?. *n fact, Perl can ma#e this comparison, but it does so using different logic and different operators. As far as Perl is concerned, "dog" is greater than "cat" because it comes after cat alphabetically. 1onversely, we can say that "cat" is less than "dog". "he string greater-than operator in Perl is "gt", and the string e8uality operator is "e8", thus if EpetA contained "cat" and Epet' contained "dog" we could compare%
yields yields
false true
"here are many possible reasons to compare variables -- this tutorial is not in-depth enough to e plore these in detail. "he table below summari5es the common comparison operators, which you can use when and if you encounter a situation where such a comparison would be useful.
less-than PL arithmetic greater-than or eBual to arithmetic less-than or eBual to arithmetic eBuality arithmetic ineBuality string greater-than string lessthan string greater-than or eBual to
than right value. (ompares whether left value is eBual to or greater than right value. (ompares whether left value is eBual to or less than right value (ompares whether left value is eBual to right value. (ompares whether left value is not eBual to right value. (ompares whether left value comes alphabetically after right value. (ompares whether left value comes alphabetically before right value. (ompares whether left value is eBual to or comes alphabetically after right value. ;9@C19 true
QL
19AC19
true
LL 9L gt lt
ge
8pat8 ge 8pat8
true
le
string less(ompares whether left value is eBual to than or eBual or comes alphabetically before right to value. string eBuality string ineBuality (ompares whether left value is exactly the same as the right value. (ompares whether left value is at all different from the right value.
8sat8 le 8pat8
false
e8 ne
false true
$e use list variables fre8uently in real life. A shopping list contains a bunch of values -- names of items. A budget is a list of arithmetic values -- e penditures. @ist variables are 8uite different from scalar variables because they do not share the same types of operations. After all, it doesn&t ma#e much sense to compare whether a list of colors is "greater" than a list of pet names >it does ma#e sense to compare whether one list is longer than another, but then the length of a list is a scalar variable?. "o prevent variable name confusion, lists in Perl are prefi ed with the at-sign character >R?. "he values contained in a list are called items, and assigning a list of items to a list is 8uite simple%
@shopping=("milk","eggs","bread","cheetos");
Bow then, the list Rshopping contains four items, inde ed in the order they were created. "he first item in the list is "mil#", the second is "eggs", and so on. 1m&ortant: the first item in a list is counted as index number zero. +estated, item A in this list is "mil#", item I is "eggs", and so on. 6ere&s the confusing bit% when wor#ing with lists, we sometimes wor# with the list as a whole and other times wor# with particular items from the list. $or#ing with a single item from a list is a scalar activity, as we saw in the earlier sections. You can reference a single item from a list using its inde %
$shopping[0]="skim milk";
"he above variable refers to the first item in the Rshopping list, which has been assigned a new value, "s#im mil#". Botice, though, that this reference used a E rather than an R -- because this one item in the list is scalar. $hat if you wanted to wor# with more than one item from the list, but not the whole list: "hat, then, would constitute a slice, because it is still a list >a list of a list9?%
$#shopping
"he above returns the number of the highest inde in the list3 in this e ample, that would be K. +emember that the list begins at inde A, so a high inde of K means that this list contains . items. *f you&ve ever wondered why programmers are, well, the way they are ... just remember that they have to deal with this #ind of thing day in and day out9 @ists provide a convenient means for many types of data sorting, but, again, this tutorial is very much a starter course. Once familiar with the basics of these Perl fundamentals, the twists and turns that come down the road will be that much less di55ying.
+ecall our shopping list -- in its original form, this data was suited to a Perl list because it was merely an arbitrary list of items. 'ut would this list be useful in the real world: *f 0usan were to hand her husband 4elvin this list, he might pic# up mil#, but which mil# would he buy: Perhaps 0usan would want 4elvin to purchase the brand of mil# on sale this wee#, meaning that the specific brand to buy may change from wee# to wee#. *n this case, the grocery list must be e panded so that it can relate the items to some additional information3 e.g.
8milk8 is related with 85oly (ow !rand /E8 8eggs8 is related with 8'tore !rand 2arge8 8bread8 is related with 8'murf !akery 2ight +heat8
"he above data, in Perl parlance, is #nown as a set of e!"value pairs. On the left side are the #eys >"mil#","eggs", and "bread"? and on the right side are the values. A hash, then, is actually a list of #ey-value pairs. 6ashes are referred to with the prefi N. 1reating the initial hash for this grocery list is simple%
%shopping=("milk","Holy Cow 1%", "eggs","Store Brand Large", "bread","Smurf Bakery Light Wheat");
As with lists, any single item in the hash is referred to as a scalar variable. ;nli#e lists -- and this is where the power of hashes come in -- the order of the items is unimportant. 6ashes do not use inde es to see their data, they use the #eys. 0o, if we wanted to see the value for the #ey "mil#"%
print $shopping{"milk"};
"he above line would output "6oly 1ow IN". Be t wee#, when the sales change, 0usan can easily assign a different mil# brand value to the mil# #ey%
%freq=();
*magine that Eword represents the most recent word read in from the source data%
$freq{$word}++;
"he above line increments the value of the specified #ey. +e8uesting the fre8uency of the word "happy" then becomes trivially easy%
$freq{"happy"}
Perl 3un!tions
A function is li#e sending out for pi55a ... you call a third-party >the pi55a shop?, provide some parameters >your name, your order?, and in KA minutes or less the results appear at the door. ,unctions, though, wor# much more 8uic#ly and don&t need to be tipped. Perl comes with many, many functions built-in. "hese functions range widely in use, from manipulating numbers and strings to wor#ing with files on dis#. 0ome functions re8uire e tra information to tell them how to do their job -- these are called parameters. 0ome functions are used inside of larger e pressions while others can stand alone. 4any functions can be any of the above. 1onsider the humble lc function. "his function accepts one parameter, a string, and returns a copy of the string in all lowercase letters%
$str="HELLO"; $lowerStr=lc($str);
*n the above, the variable Elower0tr would contain the value "hello". Botice how the lc function is used within an assignment operator3 after all, using lc by itself...
lc($str);
...would not achieve anything since its returned value has nowhere to go and would evaporate. Botice, though, that the lc function does not change the content of Estr at all -- it merely returns a modified cop! of Estr. 0ome functions act directly on the variable passed to them -- these functions happily stand alone. ,or e ample, the chop function hac#s off the last character in a string%
$str="one,two,three,"; chop($str);
"he chop call actually modifies the value of Estr to "one, two,three". Although chop can be used standalone, that doesn&t mean it doesn&t return any information. *n fact, if used in an e pression, chop returns the character that it severed off the original string. "hus%
$str="one,two,three,"; $chopped=chop($str);
"he above would both chop the final comma from Estr and assign that comma to Echopped. "ypically there is no need to save the hac#ed off part of the string, which is why chop is commonly used without being part of a larger e pression. ,unctions don&t necessarily have to accept their parameters inside parentheses. You may well see e amples of functions which are called without any parentheses, such as "chop Estr". *n fact, you&ve already seen such an e ample in this article -- the print function. As a rule of thumb, though, it is best to #eep using the parentheses to enclose parameters being passed to the function -- print is an e ception in that it is widely accepted without parentheses. Perl lets you get away with much syntactical sloppiness, but that doesn&t mean it is a good idea. ;sing functions is straightforward, and an essential part of Perl. "he good news is that Perl includes a huge number of built-in functions ready and waiting to ma#e programming easier, from handling mathematic calculations to hac#ing up strings into various bits and pieces to managing times and dates to writing to and reading from data files. "he bad news is that there are simply too many functions to summari5e in this article. "he e tra good news is that these functions have already been summari5ed and categori5ed, and you can find them in the perlfunc documentation at (P 7, the 1omprehensive Perl Archive Betwor#.
'y default, Perl programs, li#e many other languages, e ecute in the order the code is written, from top to bottom. "his order of e ecution is #nown as "program flow" in te tboo#s, and there are a variety of reasons why we might want to alter the program flow under certain circumstances. Again, consider the parallels to real life -- you may plan out your day in a certain order, but variable circumstances may change this order. ,or instance, your day plan might loo# li#e%
if (bank { go to else { go to go to
"he use of conditional logic allows your schedule to become more fle ible -- go to the ban# first if it is open, otherwise go to the grocery and then go to the ban#. 0imilarly, we apply the same sort of logic to the flow of Perl programs. "he two main controls which alter program flow are conditionals and loops. 1onditionals, li#e the if...else statement seen in the above e ample, determine what actions to ta#e when certain conditions are met or are not met. @oops are used to repeat one or more actions a certain number of times based upon certain conditions.
Botice that the actions clause is enclosed within curly braces. A set of curly braces is #nown as a statement bloc , and any number of Perl statements can appear here, separated by semicolons. +ecalling our currency conversion e ample, we can output a message sensitive to which currency is more valuable than the other%
if ($USTotal>$CDNTotal) { print "Presently, the US dollar is ". "worth more than the Canadian dollar.\n" }
"he else clause of an if statement lets you define a statement bloc# in case the conditional test is false%
if ($USTotal>$CDNTotal) { print "Presently, the US dollar is ". "worth more than the Canadian dollar.\n" } else { print "Presently, the Canadian dollar is ". "worth more than the US dollar.\n" }
;nfortunately, the above e ample is flawed. *t is theoretically possible that both currencies are of e8ual value. "he elsif clause acts as a combined else and if clause, allowing an else clause which tests an additional condition. "his may be clearer by e ample%
7ote the way the output strings have been broken up into multiple segments. lthough we could have simply typed one long line, it would have been difficult to read within this article. To make the line more legible, the output string has been broken into portions, with a concatenation operator, the 8.8, between each portion. The result is exactly the same as if we typed one long line.
if ($USTotal>$CDNTotal) { print "Presently, the US dollar is ". "worth more than the Canadian dollar.\n" } elsif ($USTotal==$CDNTotal) { print "Presently, both the US dollar and ". "the Canadian dollar are of equal value.\n" }
else { print "Presently, the Canadian dollar is ". "worth more than the US dollar.\n" }
"he statement above actually tests two conditions% if the ;0 dollar is worth more then the first message is output3 if the two are e8ual then the second message is output3 the process of elimination tells us that if neither of these were true than the ;0 dollar must be worth less, so the third message it output. A few notes on synta % the formatting and indentation used in these e amples is merely one style, albeit a style this author finds intuitive and legible. Other programmers may favor different styles of indentation -- Perl is very fle ible and essentially lets you format statements and statement bloc#s any way you li#e. Also, note that the elsif clause of this statement is spelled strangely, missing the second "e" that it seems it should have. Perl can be 8uir#y. A related variation of the if statement is the unless statement. "his statement merely tests if the given condition is not true%
Ej increments to II, which of course is greater than IA. At that point the loop e its and Perl passes over the statement bloc# and moves onto the ne t statement in the program. $hen dealing with lists, the foreach loop provides a simple way to iterate through each item in the list. +ecall our grocery list from earlier, Rshopping. 0uppose you wanted to wor# with each item in Rshopping%
if (bank { go to else { go to go to
"he use of conditional logic allows your schedule to become more fle ible -- go to the ban# first if it is open, otherwise go to the grocery and then go to the ban#. 0imilarly, we apply the same sort of logic to the flow of Perl programs. "he two main controls which alter program flow are conditionals and loops. 1onditionals, li#e the if...else statement seen in the above e ample, determine what actions to ta#e when certain conditions are met or are not met. @oops are used to repeat one or more actions a certain number of times based upon certain conditions.
One of the most intuitive conditionals is the if statement. You can read this e ample aloud to ma#e the logic perfectly clear%
Botice that the actions clause is enclosed within curly braces. A set of curly braces is #nown as a statement bloc , and any number of Perl statements can appear here, separated by semicolons. +ecalling our currency conversion e ample, we can output a message sensitive to which currency is more valuable than the other%
if ($USTotal>$CDNTotal) { print "Presently, the US dollar is ". "worth more than the Canadian dollar.\n" }
"he else clause of an if statement lets you define a statement bloc# in case the conditional test is false%
if ($USTotal>$CDNTotal) { print "Presently, the US dollar is ". "worth more than the Canadian dollar.\n" } else { print "Presently, the Canadian dollar is ". "worth more than the US dollar.\n" }
;nfortunately, the above e ample is flawed. *t is theoretically possible that both currencies are of e8ual value. "he elsif clause acts as a combined else and if clause, allowing an else clause which tests an additional condition. "his may be clearer by e ample%
if ($USTotal>$CDNTotal) { print "Presently, the US dollar is ". "worth more than the Canadian dollar.\n" } elsif ($USTotal==$CDNTotal) { print "Presently, both the US dollar and ". "the Canadian dollar are of equal value.\n" } else { print "Presently, the Canadian dollar is ". "worth more than the US dollar.\n" }
7ote the way the output strings have been broken up into multiple segments. lthough we could have simply typed one long line, it would have been difficult to read within this article. To make the line more legible, the output string has been broken into portions, with a concatenation operator, the 8.8, between each portion. The result is exactly the same as if we typed one long line.
"he statement above actually tests two conditions% if the ;0 dollar is worth more then the first message is output3 if the two are e8ual then the second message is output3 the process of elimination tells us that if neither of these were true than the ;0 dollar must be worth less, so the third message it output. A few notes on synta % the formatting and indentation used in these e amples is merely one style, albeit a style this author finds intuitive and legible. Other programmers may favor different styles of indentation -- Perl is very fle ible and essentially lets you format statements and statement bloc#s any way you li#e. Also, note that the elsif clause of this statement is spelled strangely, missing the second "e" that it seems it should have. Perl can be 8uir#y. A related variation of the if statement is the unless statement. "his statement merely tests if the given condition is not true%
*n this logic, if the ban# is not open then we go shopping first3 otherwise the ban# is open and we go to the ban# first. "he unless statement can sometimes be confusing to wor# through mentally, though it might help to thin# of it as meaning "if the condition is not true". *n every other way unless behaves li#e the if statement, and can ta#e additional elsif and!or else clauses.
'on!lusion
,or many people, the fun of driving a car is not the movement of one&s foot from gas pedal to bra#e pedal, or the method for turning on the wipers or shifting into reverse. "he fun of driving, for most, is the travel -- going from one place to another, the scenery, and of course the speed. 0till, there is a smaller hard-core segment of fol#s who are enamored with shifting gears and how the bra#es wor#. Perl is 8uite the same -- Perl enthusiasts love getting their hands covered with grease, but you can get from A to ' with Perl without needing to #now how to rebuild its transmission9 "his article has tried to survey a wide range of territory towards this end. A web developer is primarily interested in using Perl as a tool towards web-related goals. *n doing so, the web developer will need a basic understanding of the principles of Perl programming, and that has been the focus of much of this introductory piece. ;sing Perl with 1<* to create interactive and dynamic web pages is the fun part of all this. 'ut you can&t cruise the interstate after your first driver&s ed lesson and, similarly, we&ve only seen a glimmer of the fun Perl can offer on the web. "he stage has been set, though, and ne t time we can put this Perl into drive, from validating form submissions to processing database re8uests to shopping cart applications. (room.
&eso$r"es
'elena 'ol's #ntroduction to Perl (-# Programming /9/, by )acBueline &. 5amilton (-# 6odule .eference >technical? 'ummary and &ocumentation of 'tandard Perl 6odules