%
% \perltut.tex -- LaTeX \perl\ tutorial written for 2001 Reflections/Projections
%
%  by Stephen Saville
%  ssaville@uiuc.edu, zampire@hotmail.com
%  http://zampire.zampire.net/
%

\documentclass[12pt]{article}

\newcommand{\perl}{Perl}
\newcommand{\bksl}{\char92}

\newenvironment{safeitems}{\begin{minipage}[t]{5in}\begin{itemize}}{\end{itemize}\end{minipage}}

\pagestyle{headings}

\setlength{\textwidth}{\textwidth}
\setlength{\textheight}{8in}

\title{ACM Reflections Projections \perl\ Tutorial}
\author{Stephen Saville}
\date{14 Oct 2001}

\begin{document}
\maketitle

%
% A Brief Introduction to Perl
%
\section{A Brief Introduction to \perl}
\label{sect:introduction}

Now, everybody's solution to a system administration problem is not to write a
new scripting language, but that's exactly what Larry Wall did back in 1987 when
he found the news reader rn (which he also wrote) to be insufficient for the
task. In the years since then, \perl, the "Practical Extraction and Report 
Langauge," or "Pathologically Eclectic Rubbish Lister," depending on who you
talk to, has grown from a one-person hack to a community supported language with
ports for almost every modern operating system available. In many cases \perl\ has
become THE tool of choice for system adminstration, because it can actually do
just about anything.

With its powerful and well-developed module system, including tie-ins to many
useful C libraries, the possibilities with perl and endless.
Nevertheless, most of these uses are beyond the scope of
this tutorial. The focus of this tutorial is rather on the \perl\ language itself,
and a few of its main strengths. After working through this tutorial or
attending the Reflections Projections workshop, you should have a basic grasp of
the fundamental aspects of the \perl\ langauge, and enough knowledge to get
something out of the references listed at the end of this tutorial.

%
% Starting Perl
%
\subsection{Starting \perl}
\label{sect:starting}

The simplest way to start \perl\ is just by running the \perl\ program with no
arguments. In this tutorial, every line that begins with a `{\tt \%}' should
be interpreted as a shell commmand. So type `{\tt perl}' on the command line
and press enter:

\begin{verbatim}
% perl
\end{verbatim}

You have now invoked the \perl\ interpreter! Patienly the interpreter sits there,
waiting for you to type in some \perl\ code for it to compile. Let's give it some
\perl\ to play with:

\begin{verbatim}
% perl
print "I like Perl\n";
\end{verbatim}

When you're done, just type Ctrl-D to tell \perl\ you have finished writing the
program. Now, the interpreter can go to work executing your \perl\ code:

\begin{verbatim}
% perl
print "I like Perl\n";
I like Perl
\end{verbatim}

As you can see, once \perl\ finishes executing your code, it returns you back to
the command prompt so you can do whatever other work you might want to
accomplish. However, this is not the only way to use \perl, for by the \perl\
motto: "There's more than one way to do it" (often abbreviated TMTOWTDI).
You could also have created a file called, say ``{\tt script.pl}'', with some
\perl\ code in it and then run it through the \perl\ interpreter with the command:

\begin{verbatim}
% perl script.pl
\end{verbatim}

Alternatively, you could use the {\tt -e} switch to have \perl\ run a small bit
of code. This method is called a \perl\ one-liner.

\begin{verbatim}
% perl -e 'print("I like Perl");'
\end{verbatim}

Finally (for our purposes), you could make the a file containing \perl\ code (a
script) executable by either setting its viewer to be the \perl\ program in
Windows or putting the following text on the first line of a script file in
Unix:

\begin{verbatim}
#!/usr/bin/perl -w
\end{verbatim}

Under Unix, you would also have to make the program executable before you could
run it by setting the execute file permission with:

\begin{verbatim}
% chmod a+x script.pl
\end{verbatim}

Then, the perl program could be run with the command:

\begin{verbatim}
% ./script.pl
\end{verbatim}

%
% The Essence of Perl
%
\section{The Essence of \perl}
\label{sect:essence}

\perl\ takes inspiration from both scripting langauges and compiled languages
like C. Generally, whitespace is ignored and lines must be terminated with a
semicolon ({\tt ;}). However, comments are formatted as in shell scripts. Every
character on a line after a associative array ({\tt \#}) is a comment and ignored by the
compiler. \perl\ has no way to comment out blocks of code like C's {\tt /* \ldots
*/} sequence. In summary:

\begin{verbatim}
#!/usr/bin/perl -w
# this line is a comment
print "this is a statement, terminated by a semicolon\n"; # comments here too
print "proper formatting",
           " is not",               " necessary",
   " but it is",
# comment in the middle of a statement
      " preffered\n";
#
# print "this statement will not be executed\n";
\end{verbatim}

%
% Variables
%
\subsection{Variables}
\label{sect_variables}

\perl\ variables fall into just three different types: scalars, arrays, and
associative arrays. The simple type of a variable is indicated by the character
which begins the variable name (either %{\tt \$}, {\tt @}, or {\tt \%}). 
The variable name, or "identifier" may contain letters, numbers, and the
underscore `{\tt \_}'. Identifiers, like all of perl are case sensitive, so 
`{\tt \$var}' is a different variable than `{\tt \$VAR}'. The variables are
summarized below and will be explored more completely in the following sections.

\begin{description}

% scalar type
\item[scalar]
\begin{safeitems}
\item identifier begins with a dollar sign ({\tt \$})
\item may contain an integer, floating-point number, or string
\end{safeitems}

% array type
\item[array]
\begin{safeitems}
\item identifier begins with the at sign ({\tt @})
\item contains an array of scalars referenced by integers.
\item use {\tt @array[<integer>]} to access an array element
\end{safeitems}

% scalar type
\item[associative array]
\begin{safeitems}
\item identifier begins with the percent sign ({\tt \%})
\item also called an ``associative array''
\item contains a collection of scalars referenced by scalars
\item use {\tt \%associative\_ array\{<scalar>\}} to access an
associative array element
\end{safeitems}

\end{description}

%
% Scalars and Literals
%
\subsection{Scalars and Literals}
\label{sect:scalars}

Unlike some other langauges, you don't have to tell \perl\ what kind of type a
scalar will be --- just assign it a value using the equals ({\tt =}) sign:

\begin{verbatim}
$exclamation = "woohoo!";
$answer = 42;
$pi = 3.1415927;
$exclamation = 132; # perfectly legal
\end{verbatim}

For the most part, numerical literals are fairly straightforward in \perl. Like
in C, you can enter an integer in hex or octal by prepending `{\tt 0x}' or
'{\tt 0}' to the beggining of the number. Strings literals are nevertheless more
interesting animals.

%
% Strings
%
\subsubsection{Strings}
\label{sect:stings}

Strings can be specified in actually a miriad of different ways (remember
TMTOWTDI), but we're only going to concentrate on the three most common.

\begin{description}

% single quoted
\item[single quotes ({\tt '})]
single quoted strings such as {\tt 'neato, a string'} are interpreted literally.
This literally means that you can put \emph{anything} between single quotes, and
\perl\ will include it in the string. To put an apostrophe ({\tt '}) in the
string you need to escape it with a backslash ({\tt \bksl'}).

\begin{verbatim}
$password = 'sor$h&lm';
# dollar sign is not interpolated
$passphrase = 'I\'ll need $10 for that';
# need to escape the apostrophe
\end{verbatim}

% double quoted
\item[double quotes ({\tt "})]
double quoted strings like {\tt "a string with a \$string in it"} have variable
interpretation performed on them. This means that wherever a variable is
included in the string, that variable will be replaced by its value in the final
text.

\begin{verbatim}
$price = 20;
print "why does this fish cost $price dollars?\n";
# will print out "why does this fish cost 20 dollars?"
\end{verbatim}

\item[backticks ({\tt `})]
the backticks operator performs variable interpretation on the string, but then
the resulting string is executed as a shell command, and the output of the
command is returned.

\begin{verbatim}
# on unix kernels, the uname command returns selected
# information about the system its running on. the -sr
# switch prints out the system type and version
$system = `uname -sr`;
print "$system\n";
# will print "SunOS 5.8" on a machine running
# Solaris version 5.8
\end{verbatim}

\end{description}

Next, we note the operators usable on strings in Table \ref{table:stringops}.
Note that they are listed in order of precedence.

\begin{table}[hbp]
\centering
\caption{String Operators}
\label{table:stringops}
\begin{tabular}{|l|l|}
\hline
operator&description\\
\hline
.&string concatation\\
.=&string concatation with assignment\\
\hline
\end{tabular}
\end{table}

%
% PAGE BREAK -- HACKISH!
%
\vfill\eject

\subsubsection{Numbers}
\label{sect:numbers}

As mentioned earlier, numbers are fairly straightforward in \perl. The literals
are the same as in C, and the operators are fairly equivalent. For completeness,
I've included table of arithmetic operators for completeness. Use Table
\ref{table:numberops} for reference. Operators are ordered by precedence.

%
% !!! Incomplete until I get The Camel Book back
%
\begin{table}[hbp]
\centering
\caption{Arithmetic Operators}
\label{table:numberops}
\begin{tabular}{|c|l|l|}
\hline
operator&description&example\\
\hline
\tt-&unary negation&\tt-\$a\\
\tt-\,-&incriment&\tt\$a-\,-\\
\tt++&decrement&\tt\$a++\\
\tt**&exponentiation&\tt\$a ** \$b\\
\tt**&multiplication&\tt\$a * \$b\\
\tt/&division&\tt\$a / \$b\\
\tt\%&modulus&\tt\$a \% \$b\\
\tt+&addition&\tt\$a + \$b\\
\tt-&subtraction&\tt\$a - \$b\\
\hline
\end{tabular}
\end{table}

%
% Arrays
%
\subsection{Arrays}
\label{sect:arrays}

Arrays in \perl\ are a bit like arrays in C, but only a bit. For one thing,
arrays can contain any random assortment of scalars. For another, you don't
actually have to fill up every element of an array, nor do you need to declare
the size of an array. All those technical details that made C programming
tedious are taken care of by \perl. As in C, array indexes start at 0. Here are
some examples of arrays:

\begin{verbatim}
# just put some values into an array
$a[0] = 12; $a[3] = "hi"; $a[0] = 'cool';
#
# note that the @ sign is replaced by a $ sign when
# assigning to an element of an array. just think
# about a[0] as a scalar, not an array
#
#assigning arrays to arrays
@b = @a;
# using lists to initialize an arrays
@a = ("Pete", 23, 'Perl Monger');
@b = (555-2043);
@c = (@a, @b);
# @c now contains the elements in @a followed by the
# elements in @b
#
# and many more...
\end{verbatim}

As you can see, arrays in \perl\ are pretty easy to use and flexible. Note the
use of lists above. Lists are used many times in \perl, but the syntax is so
simple that the reader should be able to pick it up in the course of these two
sections.

%
% Associative Arrays
%
\subsection{Associative Arrays}
\label{sect:aarrays}

The \perl\ associative array or "hash" data type is probably one of \perl's most
useful features. An associative array is an special kind of an array that is
indexed by strings. That's a very simple definition for an extremely powerful
tool. Working with perl, you'll probably find yourself using associative arrays
in many unique and creative ways simply because they are so simple. Here's just
a few examples:

\begin{verbatim}
#
# use the dollar sign just like for arrays
$days{'December'} = 31;
#
# other scalar indices are implicitly translated into strings
$height{0} = 4;
$height{'0'} = 4;
# the above two assignments mean exactly the same thing
#
# a bunch of elements can be added to an associative array by
# assigning to it a list of key, value pairs.
%jobs = ('Andy', 'Cook', 'Denny', 'Teacher', 'Patrick', 'Student');
#
print "$jobs{'Andy'}\n"
# prints 'Cook'
#
# or, with a little syntactic sugar
%authors = ('Kernignham and Richie' => 'The C Programming Language',
           'Dubois' => 'MySQL',
           'Stewart' => 'Calculus: Early Transcendentals');
\end{verbatim}

%
% Conditionals
%
\subsection{Conditionals}
\label{sect:conditionals}

Comparisons in \perl\ can be performed between any two scalars, provided they are
either both strings or both numbers. The comparison operators are nevertheless
different for strings and numbers.

\begin{table}[hbp]
\centering
\caption{Comparison Operators}
\label{table:comparisonops}
\begin{tabular}{|c|c|l|}
\hline
strings&numbers&description\\
\hline
\tt eq&\tt ==&equality\\
\tt ne&\tt !=&inequality\\
\tt gt&\tt >&greater than\\
\tt ge&\tt >=&greater than or equal\\
\tt lt&\tt <&less than\\
\tt le&\tt <=&less than or equal\\
\tt cmp&\tt <=>&comparison, returns -1,0,1\\
\hline
\end{tabular}
\end{table}

You can also use the boolean operators {\tt \&\&} (AND) and {\tt ||} (OR) to build up more
complicated conditionals.

\vspace{\baselineskip}And now for the truths and the lies...

\begin{verbatim}
# values that evaluate to true
    1;         # duh!
    ("a","b"); # the list has elements
    " ";       # whitespace is true
    "false";   # so are strings
    "00";      # a string
# values that evaluate to false
    0;         # by convention
    ();        # list is empty
    "";        # string is zero-length
    "0";       # interpreted as zero
\end{verbatim}

%
% Controlling Perl
%
\section{Controlling \perl}
\label{sect:control}

\perl\ has {\tt if} statements to control execution and {\tt do/while} as well as
{\tt for} and {\tt foreach} loops to repeat series of commands. Also, for
reusing code, \perl\ provides subroutines. The syntax for these constructs is
much like C, but not quite, so pay attention. Those fine points are the worst.

\subsection{Conditional Statements}
\label{sect:ifelse}

The {\tt if, else, elsif} statements in \perl\ conditionally execute a piece of
code based on the value of a conditional expression. The basic form of the {\tt
if} and {\tt elsif} statements is {\tt if/elsif (<conditional>) \{<code>\}}. The
curly braces are required. Perl will give you an error if you forget to put them
in. In general, a conditional statement is an {\tt if} statement followed by
zero or more {\tt elsif} statements and an optional {\tt else} statement. The
code in the first {\tt if} or {\tt elsif} associated with a true conditional
will be executed. The code in the {\tt else} statement will be executed if
none of the coditionals are true. Following is an example:

\begin{verbatim}
# remember, only the first if/else with a true
# conditional gets executed
#
if (1) {
    print("this message will always print");
}
elseif (1) {
    print("this message will never print");
}
#
# regular expressions can be used in conditionals too
#
$text = "words or words or words";
if ($text =~ /letters/) {
    print ("\"$text\" includes the word \"letters\"\n");
}
elsif ($text =~ /words/) {
    print ("\"$text\" includes the word \"words\"\n");
else {
    print ("\"$text\" is most uninteresting\n");
}
\end{verbatim}

\subsection{Loops}
\label{sect:loops}

Sometimes you want to execute a piece of code many times in succession. Instead
of forcing you to retype the code, \perl\ has loops that allow for controlled
repetition of a piece of code. The most simple form of a loop is the {\tt while}
loop that executes a piece of code as long as a conditional expression is true.
As before, the curly braces are not optional.

\begin{verbatim}
while (<conditional>) {
    <code>
}
\end{verbatim}

Also, \perl\ has a {\tt do\ldots while} statement that is like a {\tt while}
loop, but it is executed at least once.

\begin{verbatim}
do {
    <code>
} while (<conditional>)
\end{verbatim}

In addition, \perl\ has the more complicated {\tt for} loop. The {\tt for} loop
is useful for doing something a specific number of times or possibly executing
some code for each member of an array.

\begin{verbatim}
for (<init>; <conditional>; <step>) {
    <code>
}
\end{verbatim}

and an example...

\begin{verbatim}
# print "Have a nice day" five times
#
for ($n = 0; $n < 5; $n++) {
   print "Have a nice day\n";
}
#
# print the string "123456789";
#
for ($num = 1; $num < 10; $num++) {
    print $num;
}
#
\end{verbatim}

Finally, perl has a very special loop for iterating over the contents of an
array. the {\tt foreach} loop assigns in turn each member of an array to the
given scalar and then executes the block of code.

\begin{verbatim}
foreach <scalar> (<array>) {
    <code>
}
\end{verbatim}

To look at each key/value pair in associative array, use the {\tt keys} function
like as follows.

\begin{verbatim}
%aug_birthdays = ('Robert' => 10,
                'Florence' => 15,
                'David' => 25);
foreach $person (keys %aug_birthdays) {
    print "$person's birthday is Aug $aug_birthdays{$person}";
}
\end{verbatim}

\subsubsection{Controlling Loops}

\perl\ has two statements for controlling how a loop is executed. They are
summarized below.

\begin{description}

\item[\tt next] skip the rest of the code in this loop and go on to the next
iteration.

\item[\tt last] exit out of this loop.

\end{description}

\subsection{Subroutines}
\label{sect:subroutines}

Subroutines provide a convenient mechanism for packaging up code that you want
to execute in many different places. They can be given arguments and may return
values. In this case, subroutines can be used as functions. The most simple
subroutine takes no arguments and returns no values.

\begin{verbatim}
sub my_print
{
    print "hello\n";
}
\end{verbatim}

To call a subroutine, either place an ampersand in front of the subroutine name,
or follow the name with a pair of parentheses. A bare word followed by a
semicolon may also be executed as a subroutine in some circumstances (but avoid
doing that).

\begin{verbatim}
# all of the following do the same thing
&my_print;
my_print();
my_print;
\end{verbatim}

To call a subroutine with arguments, put a list of arguments in the parentheses
after the subroutine name.

\begin{verbatim}
my_print("hello");
\end{verbatim}

To get the arguments passed to a function, you must use the perl special
variable `{\tt \@\_}'. As indicated by the prefix, this variable is an array of
all the arguments passed to the subroutine. To make the above code work, change
the {\tt my\_print} subroutine thus:

\begin{verbatim}
sub my_print
{
    print "$_[0]\n";
}
\end{verbatim}

The last thing you need to know is how to return a value from a function. This
is actually the most silly of them all. The programmer doesn't have to
specifically tell \perl\ what to return from a subroutine. Perl just returns the
result of the last expression in the subroutine. For example, to write a
recursive factorial subroutine for perl, you could say:

\begin{verbatim}
sub factorial
{
    if ($_[0] == 0 {
        1;
    }
    else {
        $_[0] * factorial($_[0]-1);
    }
}
#
# and to use it...
$result = factorial(6);
print "$result\n";
#
# prints "720"
\end{verbatim}

\subsubsection{Localization and Declaration}
\label{sect:localization}

Up to this point we've neglected to talk about variable declaration or scope
inside \perl. In \perl\, variables do not need to be declared, but they don't
have to be. (remember TMTOWTDI). The benefits of declaring variables are
increased code readability and also a little more control over scope. You see,
in \perl\, variables are global by default. Whether the variable is initialized
in a subroutine, loop, or elsewhere, it is visible to the entire rest of the
script. Sometimes this is useful, but often it may not be. \perl\ provides two
mechanisms for declaring/scoping variables, {\tt local}, and {\tt my} (we'll
pretend for now that {\tt our} doesn't exist).

\begin{description}

\item[\tt local] performs dynamic scoping on a variable by giving a global
variable a temporary value. In most cases, this is not what you want and
therefore you should avoid {\tt local} declarations.

\item[\tt my] performs lexical scoping on a variable. This is almost always what
you want, so use it!

\end{description}

\section{Monkey Read, Monkey Write}
\label{sect:monkey}



%
% Search and Destroy, etc.
%
\section{Search and Destroy, etc.}
\label{sect:search}

One of the most useful parts of perl is probably its facility for using regular
expressions. Regular expressions are little bits of code that describe a piece
of text. Perl is not alone in its use of regular expressions. In fact they are
so useful that most computer langauges either have them build in or have regular
expression libraries build for them. What is presented here is only a miniscule
subset of what can be done with regular expressions, but whole books could be
written on them (in fact one has -- see the references). You will definitely
want to learn more about regular expressions as you start to use \perl.

%
% Regular Expressions
%
\subsection{Regular Expressions}
\label{sect:regexp}

Regular expressions describe a bit of text. In perl, we can perform three basic
operations with regular expressions: matching, capturing, and substitution.
Let's see what \perl's regular expressions can do with the string:

\begin{verbatim}
$log_line = '208.190.213.12 - - [16/Aug/2001:07:49:29 -0500]' .
            '"GET /apache_pb.gif HTTP/1.1" 200 2326';
\end{verbatim}

{\noindent
which is a line from the {\tt access\_log} of an Apache HTTP server.
}

%
% Matching
%
\subsubsection{Matching}
\label{sect:matching}

With matching, we can see if the the text conforms to a certain description. In
the most simple case, we can check if the text contains a certain sequence of
characters. In the following example, we check if the string {\tt \$log\_line}
contains the word ``{\tt apache\_pb}'', which it does. The `{\tt =~}' operator
\emph{binds} a string to a regular expression and returns `{\tt true}' if the
string matches the expression.

\begin{verbatim}
# matching a string to a string
$log_line =~ /apache_pb/; # returns true
\end{verbatim}

Regular expressions also provide something called a ``character class'' which
can match a certain set of characters at the point it appears in the regular
expression. Regular expressions also include facilities for specifying how many
characters in the text being evaluated should match each character in the
regular expression. Thirdly, a regular expression may specify \emph{where} a
match should occur. The exact syntax for these facilities is beyond the scope of
this tutorial, but you can peruse the following examples for a taste of regular
expressions.

\begin{verbatim}
# a simple example
$log_line =~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/;
#
# or, a much more convoluted example
$ipnum = qr/([0-1]?\d\d?|2[0-4]\d|25[0-5])/;
$log_line =~ /^$ipnum\.$ipnum\.$ip_num\.$ip_num\s/;
#
# and finally, a decent compromise
$log_line =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s/;
\end{verbatim}

All these regular expressions will match the IP address at the beggining of
\$log\_line, but they aren't all quite the same. The first will match \emph{any}
sequence of four integers separated by periods ({\tt 208.190.213.12 \emph{and}
1.45.3.999 \emph{and} 314156.2171828.1618.1412}). The second will match
\emph{only} valid ip addresses and {\tt 0.0.0.0} -- not a valid ip address, but
close. The third one falls somewhere in the middle, and should be sufficient for
our purposes.

%
% Capturing
%
\subsubsection{Capturing}
\label{sect:capturing}

In perl, you can slurp up any text matched in a regular expression by putting
parentheses around it. The parenthesized parts of a successful regular
expression match will be put in the variables {\tt \$1, \$2, \$3, \ldots} in
order according to where the parenthesis are in the regular expression. For
example, the following regular expression will put the four parts of the ip
address in {\tt \$1, \$2, \$3,} and {\tt \$4}.

\begin{verbatim}
$log_line =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\s/;
\end{verbatim}

altrernatively, if we wanted to grab the whole ip address in one operation, we
could put the parentheses around the whole ip address expression.

\begin{verbatim}
$log_line = /^(\d+\.\d+\.\d+\.\d+)\s/;
\end{verbatim}

%
% Substitution
%
\subsubsection{Substitution}
\label{sect:substituation}

Finally, we take a brief look at the substitution capabilities of perl.
Substitution is most simply described in the analogy to search and replace
operation in many text editors. The substitution operator ({\tt
s/<find>/<replace>/}) has two parts. The first part specifies a regular
expression to find, and the second part specifies some text to replace it with.
See if you can follow the following example.

\begin{verbatim}
$text = "I built my house on the sand.";
$text =~ s/sand/rock/;
print "$text\n";
# prints "I built my house on the rock."
\end{verbatim}

Basically, the regular expression stops when it matches the word ``{\tt sand}''
and then replaces that match with the word ``{\tt rock}''. If you wanted to,
say, change all the {\tt o}'s to {\tt 0}'s in a string, then you'd have to use 
the `{\tt \\g}'' modifier to tell \perl\ to keep going after it finds one match.

\begin{verbatim}
$text = "more tomes roam rome";
$text =~ s/o/0/g;
print "$text\n";
# prints "m0re t0mes r0am r0me"
\end{verbatim}

%
% Regular Expressions Summary
%
\subsection{Summary}
\label{sect:regexpsummary}

The preceding discussion on regular expressions is really much too brief, but it
would really require a complete new tutorial to fully desctibe regular
expressions in \perl\ (or any other language, for that matter). Nevertheless,
there is much more information online about regular expressions, or you can
check out some of the references to see what they have to say about them (much
more than I've said).

Nevertheless, this section should have given you at least a glimpse of what is
possible with regular expressions.

%
% References
%
\begin{thebibliography}{99}

\bibitem{Friedl} Friedel, Jeffrey E. F..
{\it Mastering Regular Expressions}.
Cambridge: O'Reilly, Dec 1998.

\bibitem{Srinivasan} Srinivasan, Sriram.
{\it Advanced Perl Programming}
Cambridge: O'Reilly, August 1997.

\bibitem{Wall} Wall, Larry, Tom Christiansen \& Jon Orwant.
{\it Programming Perl}
Cambridge: O'Reilly, July 2000.

\end{thebibliography}

\end{document}
