Beginning Perl

ISBN 1-861003-14-5  Price £28.99 UK
Simon Cozens with Peter Wainright           14 Chapters, 9 Appendices and Index in 647 pages

Chapter List

         1    First steps in Perl
         2     Working with Simple Values
         3    List and Hashes
         4    Loops and Decisions
        5    Regular Expressions
        6    Files and Data
        7    References
        8    Subroutines
        9    Running and Debugging Perl
        10  Modules
        11  Object-Oriented Perl
        12  Introduction to CGI
        13  Perl and Databases
        14  The World of Perl

    Appendix A
        Regular Expressions

    Appendix B
        Special Variables

    Appendix C
        Function Reference

    Appendix D
        The Perl Standard Modules

    Appendix E
        Command Line Reference

    Appendix F
        The ASCII Character Set

    Appendix G
        Licences

    Appendix H
        Solutions to Exercises

    Appendix J
        Support, Errata and P2P.Wrox.Com
 

Synopsis

Perl is the programming language that was invented by Larry Wall when he was working for NASA at the JPL labs in Los Angeles.  Just now we're at the Perl 5.6 stage and even more work is being done for the next version.  In fact since the internet came along development of Perl has become a constant stream of one update after the other.  Perl is the most portable language.  It can be used with any platform.

Review

Simon Cozens is the main author of this book with some help from Peter Wainright who is also published as the Apache guru in another Wrox volume.  Peter wrote the CGI and DBI chapters.

I can vouch for the fact that anyone who isn't a Perl programmer can learn from this book. I tried to install Perl 5.6 from source into my own SuSE 6.4 machine and failed. Simon and Peter's Perl book told me how to do that in the first few pages. So, the book is easy to understand .

Right at the front there is a long list of web sites that you can go to for more information and also some info about getting the source code for the book from the Wrox site.

The book starts with a chapter called First Steps in Perl and goes on to Working with Simple Values. This is invaluable for someone who knows nothing about the Perl language. At this point it's good idea to use the source code that you downloaded from the Wrox site. I tried them all and couldn't find anything wrong with them. There's even a few joke.plx files which tell you invaluable facts about all sorts of programmers. For example, the source code that comes with chapter three has a couple of joke.plx files contained in it. When I did 'perl joke1.plx' the following printed out in the terminal window........ " Q: How many Python programmers does it take to change a light bulb ? - A:  One. He just stands below the socket and the world revolves around him." No one who is starting out on Perl programming should be allowed to miss out on this sort of professionalism.

Lists and Hashes is the next chapter. This is where I started to get confused but I did understand more after another 30 minutes of reading. The rest of the book goes into the usual things that make up the Perl language. At page 335 there is a chapter about Object-Oriented Perl. I haven't seen much about this and so I found it to be an interesting read.

Throughout the book there are the grey panels which give examples of Perl code.  All Wrox Press books are laid out in this way and it does make them easy to understand.  There are plenty of examples of code and below you can see one of those examples.....
 

  /**  " [begin quote]

#!\usr\bin\perl
#create.plx

use warnings;
use strict;
use DBI;

my ($dbh, $sth);

$dbh=DBI -> connect ( 'dbi:mysql:test','root','elephant') ||
    die "Error opening database: $DBI::errstr\n";

$sth=$dbh -> prepare ("CREATE TABLE checkin (
        id                                    INTEGER AUTO_INCREMENT PRIMARY KEY,
      firstname                        VARCHAR (32) NOT NULL,
      lastname                         VARCHAR (32) NOT NULL,
      checkedin                       INTEGER,
      numberofbags               INTEGER,
      destination                      VARCHAR (32) NOT NULL ");
$sth -> execute();             # execute the statement

$sth -> finish ();                 # finish the execution
print "All done\n"
$dbh -> disconnect || die "Failed to disconnect\n";

/**[end quote]
 

Earlier on in the book the explanation is given that Perl is mostly used for CGI programming. There's an introduction to CGI at chapter twelve which explains a few things that I haven't read or seen anywhere else. The later chapter on Perl and Databases gives a good rounded feel to the whole volume and finally there's The World of Perl which gives a glimpse of what you can do with your new found knowledge.

The nine appendices at the back of the book give some useful information that can be found elsewhere but you might need to scrape around to find any or some of it.

As Perl books go it's quite good. I've read all of the O'Reilly books on the subject and I think that Simon and Peter do a good job of not making the assumption that the reader knows what he or she is doing.

If you can change a light bulb then you can learn some basics about Perl from this book. Although, the world may not revolve around you unless you become a Python programmer ? At the very least Simon and Peter do breathe new life into a boring technical subject that most old farts still go on about. This is something that more of us should try to do.

review by

Richard Ibbotson

Back to the front page