John Bokma MexIT
freelance Perl programmer

Five must-have books on Perl programming

Friday, August 22, 2008 | 1 comment

Below follows a list of what I consider five books any serious Perl programmer must have, or at least having read once. The list is restricted to books I actually have in my office, so if you're missing a must-have book, it's probably because I don't own it (yet). Please feel free to comment with suggestions.

Also, you might wonder why "Programming Perl" isn't mentioned on the list. First, if you're a serious Perl programmer, you either already own a copy, or know your way around the documentation that comes with a Perl installation (for example using perldoc). Secondly, the most recent edition (the third at this time of writing) is a bit outdated here and there, so you might be better of using the documentation that comes with Perl.

Five must-have books on Perl programming.
Five must-have books on Perl programming.

1. Perl Cookbook, 2nd edition

Perl Cookbook is a book I like a lot due to its style: short recipes to many problems (what's in a name). The book is excellent for browsing through it, reading a few pages, and learn something new in a short time. It introduces several modules that are available via CPAN, and a lot of techniques. Highly recommended.

2. Perl Best Practices

Perl has the mythical reputation to be unreadable, a myth that one can see often repeated on sites like Slashdot. Sadly, people claiming to be authorities on how unreadable Perl is seem to confuse regular expressions - a language that can be used very easily in Perl - with the Perl language itself. Others seem to have been biased by a badly writen Perl program they've seen several years back, and are not able to see that it has nothing to do with Perl programming at all. One can program unreadable code in any language (yes Python, I am looking at you as well).

"Perl Best Practices", written by Damian Conway, not only debunks the "Perl is unreadable" myth, but teaches a lot of best practices to make your Perl code even more readable by teaching which constructs should be avoided, often with a very well written full explanation.

If you're working in a team of Perl programmers, using the practices in Damian's book as a style guide might bring a grinding halt to quite a programmer's favorite waste of time: discussing which programming style is better (and even going as far as actually "correcting" code). Been there, done that, to be honest.

While I haven't switched entirely to Damain's Perl programming style yet; some things are hard to unlearn, while with others I still somewhat disagree, I am getting closer and closer to following the style outlined in PBP.

Finally, as for unreadable regular expressions, read the book and learn how Perl has a perfect way to document each and every part of a regular expression thoroughly. Even regular expressions don't have to be unreadable, in Perl at least.

3. Mastering Perl

A recent addition to my Perl books library is "Mastering Perl" - the "vicuņa" book, after the animals depecited on the cover - by brian d foy (yes, that's all lower case, and no punctuation). The book has 15 well-written chapters on how to improve your Perl programming skills, like debugging, profiling, benchmarking, detecting and reporting errors, logging, etc. The only thing unusual about the book, in my experience with technical books that is, is that it's written in the first person. Something I can't seem to get used to each time I read a part of it.

But that aside, it's a great book. It's easy to randomly pick a section, read it, and learn a lot in just a few pages.

See also:

4. Perl Hacks

Another made for easy browsing book is Perl Hacks by chromatic, with Damian Conway and Curtis "Ovid" Poe. A book filled with tips & tools for programming, debugging, and surviving according to its cover. Each of the nine chapters in total is divided into roughly 10 hacks. Each hack ends in "hacking the hack", which discusses the well-explained hack further, often gives pointers to more related information and/or shows a variant on the hack. Most hacks are short enough to study them during a short break.

5. Higher Order Perl

Last but not least, Mark Jason Dominus' masterwork: "Higher Order Perl - Transforming Programs with Programs". This book is also recommended by brian d foy in Appendix A of the aforementioned "Mastering Perl". In his recommendation he quotes Nicholas Clark:

Don't only buy this book, read it.

from which one can conclude that Higher Order Perl is not an easy book to read, which in my experience is right on. The book needs much more effort to get through than all other aforementioned books, maybe even together. But based on the chapters I've studied so far, it's well worth the pain. Highly recommended, especially since this book will change your view on programming in general.

Also today

Please post a comment | read 1 comment by Rohan | RSS feed