on 15 December 2013
Perl one-liners are an important part of its power and flexibility. The ability to process a file quickly without having to write a program is often really useful. Any Perl programmers should take the time to get to know the command like switches that make this possible. This book is a pretty good introduction to this way of using Perl.
So why only three stars? Well, I have a couple of reservations about the book. Firstly, there are a few technical errors which the editors should have caught. For example, a few times the author refers to "array context" where he means "list context". The difference between arrays and lists is often difficult for beginners to master and it doesn't help when books blur the distinction.
My other reservation is with the programs themselves. The book boasts "130 programs that get things done". But I think they have had to stretch things a bit to get to that number. One program might be "print lines that match a pattern". Then the next program will be "print lines that don't match a pattern". I'm not sure that inverting the logic in a one-liner is enough of a difference to justify counting it separately. Sometimes you'll come across two or three pages of examples all of which are only tiny permutations of each other.
But it's good to see publishers bringing out books on Perl. And this is certainly an area of Perl that hasn't received much coverage before. I just think it's a rather thin concept to spin out to a book. Even this stretched, it's a rather thin book (140 pages - 50 of which are appendices). It might have been better as a cheap Kindle-only publication.
on 3 December 2013
This book shows the undisputed king of one-line programs in it's full Swiss-Army-Chainsaw glory. It's well written by an obvious fan of the language, and skillfully disguises a tutorial in the language.
So why four stars? Well, there's that "130 programs" thing. There's a significant amount of overlap between different recipes ("sequence of odd numbers" vs "sequence of even numbers", or "double space a file", "triple space a file" and "n-space a file" for example). That's an imperfection. I'm a tough reviewer, I guess. Another weakness is that there are only a couple of examples with "pack" and another couple with "unpack". If the book were written for me, there would more such examples. The index doesn't mention references, which is unsurprising.
But I think this will become a minor (or major) classic. Perl is a good language in many domains, but a truly great language for one-or-two line programs, and this book is a competent treatment. For the true gurus, there is probably little to learn from this book, but true gurus may ponder on a final thought before deciding not to buy:
My notoriously perl-phobic Significant Other has been engrosed in my copy after I negotiated with her a reluctant 10-minute review. Most true perl gurus are also perl evangelists, and this book may well turn out to be a "Weapon of Mass Evangelism".
(Disclosure: I received a free review copy via the O'Reilly Reader Review Program)