Author: James Lee
Publisher: Apress, 2010
Aimed at: Complete beginners
Pros: Well structured introduction to Perl
Cons: Poor layout of book
Reviewed by: Ian Elliot
This is an introductory book on Perl. Now at its third edition the cover flash boasts that it covers Perl 5.10 but there isn't much evidence of this inside the book. As the book is aimed at the beginner this doesn't really matter too much. The book concentrates on core Perl and slight changes between versions are noted when they are relevant.
As this book is aimed at beginners a brief word on what Perl is might be in order and I can do no better than quote the cover:
"Learn about the duct tape for the web, the cloud and systems administration"
The author also adds:
"For system administrators Perl is certainly the Swiss Army chainsaw that is claims to be"
Yes Perl is a "get it done" language and beginners and accidental programmers find that some of its constructs are quaint and strange - but they very rarely fail to appreciate that it gets the job done.
The style of the book is relaxed and the only thing that would make it seem more friendly would be a larger font and some more white space. Why is it that a publisher is prepared to risk sales of the book by crushing it into too small a space when on other occasions they stretch material to fill a brick?
Chapter 1 kicks off with a very well-paced introduction to Perl programming and programming in general. Unusually the author seems to have a good grasp of what the complete beginner is likely to misunderstand and what they are likely to find difficult. There are no gimmicks or fancy tricks in this book - just well and patiently explained ideas. If you read it, try it out and think about it then you will understand it.
The early chapters really do deal with the basics of programming so if you are looking for a conversion to Perl from some other language you might need to skip bits. After dealing with data in Chapter 2, Chapter 3 explains the basic controls structures with the help of flow diagrams. From here the book slowly and steadily ramps up the level - so make sure you have mastered the early chapters before moving on. Chapters 4 and 5 deal with arrays and their generalisation the hash or associative array. Chapter 6 introduces subroutines and functions and is the last of the really basic chapters.
The rest of the book moves into the skills required to apply Perl. Chapter 7 explains regular expressions, which are much of the reason that Perl is great for systems administration and anything that needs text processing. Placing it before Chapter 8 on files and Chapter 9 on string processing might seem a little odd in the grand scheme of things but not for Perl.
Chapter 10 is about interfacing to the operating system, again a core facility for system administration. Chapter 11 is about advanced data structures which are built using references, i.e. high level pointers. Then Modules are discussed and, making a sort of logical progression, object-oriented programming is introduced in Chapter 13. If you are wondering why the author leaves objects so late the answer is once again because this fits in with Perl's approach. Perl is a good procedural language and this is how it is mostly used. You can do object-oriented programming in Perl, and many do and advocate it as an approach, but the author goes to some lengths not to make the procedural programmer feel second best.
There are times when procedural script is the right thing to do.
The final chapters look at CGI and Perl's role in creating web sites - did you know that Amazon was mostly written in Perl? - and database access with DBI.
This is a good introduction to Perl and especially so for the non-programmer. It is clear and uses a good logical progression that remains true to the language. It always uses simple examples that are designed to make it easy to see how things work. Of course the negative side of this is that there are no realistic examples of how Perl is actually used - but this would be very off-putting to a beginner. There is a lot to read, and don't be fooled by its relatively small size, at 450 plus pages it packs in a lot of material.