|Perl by Example (5th Ed)|
Author: Ellie Quigley
Reaching its 5th Edition in 2015 this was a title we'd not previously included on I Programmer. We now make up for the omission by selecting it as one of our Best Books of the Year.
The 5th Edition of a classic I'd never read. How does it match up to the well known Llama book for Perl beginners?
I was surprised to find out that the Perl by Example book series covers a span almost as long at the classic “Llama book” published by O'Reilly, Learning Perl by Randal L. Schwartz, brian d foy and Tom Phoenix (see my article In Praise of Perl and the Llama). The first edition of Perl By Example’s first edition appeared in 1994 while Learning Perl had originally been published the previous year.
Not having ever read any edition of Ellie Quigley's book, and feeling that it has been left in the shadows of the O’Reilly series, although praised by its readers for its abundant examples, I was eager to discover its worth for myself.
This update, its fifth edition, sprang into existence because Perl itself was being updated. A refresh was therefore needed to cover the new language features, best practices, frameworks and modules united under the umbrella term "Modern" Perl.
Being hefty (over 800 pages), more than double the size of Learning Perl (but to be fair there is also the Learning Perl Workbook with plenty of exercises, but as a separate volume), Perl by Example is a complete guide to the language and its constructs. It also hosts real action material with the likes of Mysql, Dancer and Moose. While Learning Perl offers a more condensed, filtered and higher level overview of the language, adopting a conceptual-tutorial like approach;Perl by Example is its raw, uncut, unfiltered, down to the little details counterpart, adopting a style more akin to a self paced guide that also serves as a comprehensive reference.
The first chapter is on basic stuff like what Perl is, its history, why choose it, what versions there are and where to get it from.
Chapter 2 hosts tables laying out the syntax and its constructs , something very useful for those coming from another language needing with a glimpse to run a quick comparison to their language counterparts, thus shifting knowledge and providing answers to questions like “what is the equivalent of C++ loops in Perl?”
So what's the first thing someone is going to do? print something to the screen of course! That is what Chapter 4 is concerned with, explaining Perl’s quoting features, standard file handles, print, printf, say and the de facto use strict, use diagnostics.
Chapter 5 is about the data types whose differences are brilliantly conveyed with the use of well sketched diagrams, while Chapter 7 breaks conditionals and loops down to their bare essentials.
At this point it’s important to emphasize the way every chapter is laid out. A goal is set at the beginning of every chapter which details what should have been achieved by the time the chapter is completed with the aim of verifying that the reader actually harvested the material. But that’s not all. At the end of every chapter there is a list of revision questions (called What should you know?) which serves the same purpose, plus additional exercises helping to put ideas into code.
If you feel able to answer them then you should be confident that you really had a good grasp on the chapter's material. And it’s still not over yet, because the peak moment of the book is its examples with each code listing broken down line by line together with its output/result, leaving no room for misinterpretation, and being very detailed and easy to ‘digest’. I see now what its dedicated readers were swearing by.
Therefore the complete picture is painted by combining all those didactic components into one, creating such a strong intellectual binding that makes it is a case of not wanting to learn rather than not being able to learn!
Chapter 8 sets the basics of regular expressions while Chapter 9 goes deeper. The examples play a crucial role towards a solid comprehension, as regular expressions are much better demonstrated rather than explained.
The code walkthroughs prove particularly useful again when reaching Chapter 14 OOP Perl, as Perl’s OO model is quite different from the classic so to say, giving insight to the inner mechanisms. The chapter also highlights best practices, for example using ‘base’ and ‘parent’ instead of manually updating the ISA array, and using closures for enforcing encapsulation rather than the default which allows direct access to the object’s internals.
It does follow up with the drawbacks of multiple inheritance and how to alleviate them by using Moose and Roles. The examples become even more realistic by going through the process of summoning objects from Perl’s standard library, frequently taken place during a typical day at work.
The book turns job-oriented by supplying the necessaries for pursuing a modern career in Perl, providing a chapter on Perl and Mysql with data modeling included, and Appendixes on Moose and Dancer. It’s not clear to me why the Appendix format was chosen as they both are fully fledged and could be easily considered as main book material.
Of course it doesn’t omit the mandatory admin work (installing, setting up, maintaining Perl code bases) however, with information on Perlbrew, cpanm etc.
Summing up, if I was a beginner I would definitely get the book. However, I liked the chapters on OOP, Mysql ,Moose and Dancer which are useful regardless of your level of experience.
The book strikes a balance between not being in depth but not being superficial either, targeting beginners in Perl and in programming in general with as much information necessary for such a level, i.e. does not get into depth with subjects that should not concern the beginning programmer as of yet, like the innards of the Symbol table or Unicode, which would rather distract than aid them at this stage. At the same time it exposes the language’s constructs with brief explanations but abundant and practical examples. It’s like talking with examples rather than with words.
As such it reveals and holistically illuminates the language. Furthermore it serves the role of a reference guide, certain to be frequently revisited as the reader advances. Those experienced in other languages will find it useful too since it enables them to get quickly up to speed. But ultimately, beginners will be taken by the hand and guided through the journey of learning Perl with small and well established steps.
|Last Updated ( Thursday, 31 December 2015 )|