Learning Perl, 7th Edition

Author: Randal L. Schwartz, brian d foy, Tom Phoenix
Publisher: O'Reilly Media
Pages: 394
ISBN: 978-1491954324
Print: 1491954329
Kindle: B01M60UJY9
Audience: Beginners in both programming and programming in Perl
Rating: 5
Reviewer:Nikos Vaggalis

The new edition of an all time classic subtited "Making Easy Things Easy and Hard Things Possible". What has changed?

It has been 5 or so years since I extensively reviewed, in two parts (firstsecond), the sixth and, at the time, latest edition of the Llama book.

What has changed in between? A lot. The 6th edition covered Perl up to version 5.14, but with the current release on 5.26, 5.14 sounds like antiquated history.

Of course, the fact that Perl has grown older does not presume that Learning Pearl, 6th edition is largely deprecated. Technology moves fast, but  concepts remain, and it's these concepts that the Llama series highlights. As such, edition 7 also adopts the familiar tutorial-based approach and style, properties that render it highly usable in a classroom, even as a core textbook, but at the same time it expands on the latest upgrades the language has undergone in those 5 years.

 

Banner

 

A side-by-side comparison reveals that the content and organization remain unaltered, albeit updated, except for the three chapters on Regular Expressions which were re-structured from scratch and beefed up with more thorough and visual examples, packing in 8 more pages than its predecessor.

As such in the "Fancier Word Boundaries" section we find the new boundary syntax which adds curly braces to \b, so that for example \b{wb} becomes smart enough to recognize that the t after the apostrophe is not the start of a new word:

my $string = "this doesn't capitalize correctly.";
$string =~ s/\b{wb}(\w)/\U$1/g;

Other newly introduced boundaries include the sentence and line, while there's also the introduction of the convenience /n flag which turns all parentheses of the expression into noncapturing groups.

 

 

Like in the previous edition more advanced features like look-ahead, look-behind, embed comments, or running code in the middle of a pattern (we covered that one in Advanced Perl Regular Expressions - Extended Constructs and The Pattern Code Expression) are skipped and instead, the reader is referred to  the corresponding official perldoc documentation, or advised to consult a more advanced book like Intermediate Perl, the next in the "O'Reilly Learning to program in Perl path", a description I coined myself.

In its first chapters, the book has disclaimer labels, which warn that due to this being the first edition of the book after the release of Perl 6, Perl 6 must not be mistaken as the next and newest version of Perl 5, but that in fact it's a new language, not even a sister language, that in some places resembles Perl 5.

Other new entrances that we find due to the language upgrades, are the hexadecimal floating-point literals (instead of an e to mark the exponent, you use a p for the power of two exponent), double diamond line input operator, key-value slices, and the experimental subroutine signatures feature that adds a flair of static typing to the language, since when in effect the following piece won't even compile:

signature of subroutine:

sub max ( $m, $n ) { }

trying to call it with more arguments:

&max( 137, 48, 7 )

results in a Too many arguments error.

Talking about experiments, a new Appendix, D, is dedicated to all these features that can be optionally enabled to try new stuff out or ignored in order to stay on the safe side, courtesy of their volatile character.

What shines through its absence is the Postfix dereferencing operator, which proves a life saver when dealing with the cryptic core dereferencing syntax. While it's not covered, inquisitive readers are prompted to wait for the new imminent edition of Intermediate Perl or for the time being, check out brian d'foy's blogpost on the matter.

Concluding, Edition 7 of this classic title, once more demonstrates that Perl is a language served by quality titles, which a few of them I had the luck to review, be it O'Reilly or be it another publisher, such as in Chromatic's  Modern Perl or in Ovid's Beginning Perl.

Still in this featherweight beginner category to both programming and programming in Perl, the Llama series proves itself timeless, excelling to this day.This is partly down to the writing team that remains bonded and unaltered throughout the years and partly down to Perl always assuming a new, evolving character that keeps our interest high and going, but still staying true to its roots and foundations of the principle Making Easy Things Easy and Hard Things Possible; a principle that not only remains intact throughout time but also finds itself greatly augmented.

 

 

Related Reviews

Learning Perl, 6th Edition

In Praise of Perl and the Llama

Intermediate Perl, 2nd Edition

Mastering Perl 2nd Ed

Modern Perl, 4th Ed

Beginning Perl

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

 

 

<ASIN:1449393098>

<ASIN:B008RCQCYG> 

<ASIN:144939311X>

<ASIN:B00HS8WLYK>

<ASIN:1680500880>

<ASIN:1118013840>

<ASIN:B009K92D9I> 

Last Updated ( Thursday, 03 November 2016 )