Higher-Order Perl

Order Higher-Order Perl online from Barnes & Noble

"It's a great book ... Definitely going to go on my serious re-reading list."

—Randal L. Schwartz, author, Learning Perl


"Higher-Order Perl is the most exciting, most clearly-written, most comprehensive, and most forward-looking programming book I've read in at least ten years. It's your map to the future of programming in any language."

—Sean M. Burke, Leading Programmer, Comprehensive Perl Archive Network (CPAN)


"There are lots of books that teach you new Perl modules or techniques. This book goes beyond that and teaches a new way to think about Perl programming."

—Peter Norvig, Director of Search Quality, Google Inc.


HOP is the best programming book I've read (and I've not finished it yet). I really like the way you start with a problem, show a good solution, then its limitations, and build a better solution with the things you've shown before in the book. The many references to an earlier or further chapter of the book show how interrelated are all these techniques.

Every time I start a chapter thinking "oh yes, I already know a lot about this (recursion|dispatch tables|memoization|iterators|etc) stuff", it only takes a few pages before I find out how little I actually knew about these subjects. I really expect to come out more intelligent from reading your book. :-)

—Philippe Bruhat


Mark Jason Dominus has hit his mark with Higher Order Perl. It is a very informative book that is a must read for Perl programmers who want to take their skills to the next level.

—Mark Rutz, Linux Journal (Complete review)


"As a programmer, your bookshelf is probably overflowing with books that did nothing to change the way you program. . . or think about programming.

You're going to need a completely different shelf for this book.

While discussing caching techniques in Chapter 3, Mark Jason Dominus points out how a large enough increase in power can change the fundamental way you think about a technology. And that's precisely what this entire book does for Perl.

It raids the deepest vaults and highest towers of Computer Science, and transforms the many arcane treasures it finds—recursion, iterators, filters, memoization, partitioning, numerical methods, higher-order functions, currying, cutsorting, grammar-based parsing, lazy evaluation, and constraint programming—into powerful and practical tools for real-world programming tasks: file system interactions, HTML processing, database access, web spidering, typesetting, mail processing, home finance, text outlining, and diagram generation.

Along the way it also scatters smaller (but equally invaluable) gems, like the elegant explanation of the difference between 'scope' and 'duration' in Chapter 3, or the careful exploration of how best to return error flags in Chapter 4. It even has practical tips for Perl evangelists.

Dominus presents even the most complex ideas in simple, comprehensible ways, but never compromises on the precision and attention to detail for which he is so widely and justly admired.

His writing is—as always—lucid, eloquent, witty, and compelling.

Aptly named, this truly is a Perl book of a higher order, and essential reading for every serious Perl programmer."

—Damian Conway, Co-designer of Perl 6


"I especially appreciate your habit of introducing something with a useless but extremely targeted example, and gradually add in extraneous but increasingly useful bits until you arrive at a general example of which the point at issue is only a part. This is great for not only showing clearly what the point is, but showing how it can be used practically."

—Jesse Sheidlower


"Changing recursive functions into ones that use an agenda is awesome. I was in the middle of rewriting a very ugly part of our antispam system when I read chapters 4-6. It is the part that collects a particular user's preferences (what filters to apply and with what arguments). It used to be very imperative: get a list of plugins, sort them, process the ignores, order them by speed, transform them into something postfix recognizes. Doing everything with the whole list in memory the whole time, etc. However, when it was first designed, we figured people would have a max of 40 entries. Now there are some people with more than 6000 whitelists, each of which counts as 1 entry, so that bit of code gets enormous. Not only does it get enormous, but at that part in the program I only actually care about whether or not there are any whitelists; something else will look them up later. So now it gets a sth from mysql and goes through them one at a time, putting more things onto the queue when there's an entry that expands into multiple other entries, etc. It's a lot simpler code and it's about 33% faster.

"Oh, I also replaced a bunch of if/elsifs with a dispatch table. ... The old code made me sad to look at. This code makes me happy!"

—Dieter Pearcey, Philadelphia


I hate Perl, but I bought your book anyway, and I love it.

—Michael Tsai


Review by Bártházi András (in Hungarian).

Wolfgang Laun's English translation.


Review by Daniele Radogna (in Italian).


I finished HOP a couple of weeks ago, I enjoyed it and learned a lot of stuff. Particularly I liked the way you go through each problem, discussing options, enhancing some previous solution with new presented techniques, progressively generalising some approach, etc. In my humble opinion you are specially gifted at knowing which is the context in the reader's mind at any point.

Another thing I liked a lot in the book was that the explanations, the wording, felt natural. It's a book where a programmer talks to another programmer from experience. Used to modern math textbooks, I was a bit enlightened when I saw a few pages of Gauss' Disquisitione Arithmeticae (a beautiful Catalan edition was published) and read in the book he discussed the problems instead of just presenting the results, he explains wrong choices, false conjectures he had at some point, etc. That was natural, that's the way you understand a problem. When I readed HOP it felt that way as well.

—F. Xavier Noria, Barcelona


I love it when a technical book performs some kind of transgression on what you know and how you think. Well, I love it in any book, but tech books of course are typically expected to do something like append to your knowledge, so when one takes it in unexpected directions that's terrific. Okay, I actually expected no less from this book - MJD is a joyfully intelligent writer.

—Gaal Yahas, Tel Aviv


Should you buy it? Yes. Higher-Order Perl is one of the Perl books that should have a place on the bookshelf of every Perl programmer.

—Reinhard Voglmaier, Unix Review (Complete review)


Meine Lieblingsstelle ist, wo erklärt wird wie man die beliebige Reihenfolge von Elementen einer Liste zusammenstellt (oder mischt). Es wird da eine Art virtueller Kilometerzähler programmiert, also so ein Drehding für Zahlen wie im Auto. Das Beispiel war so einleuchtend und auch einfach schön, daß Sohn angefangen hat in Perl zu programmieren.

—Richard Lippmann, Nürnberg


It discusses topics that are important for all programmers to know and does it in a way that makes the material quite accessible. It is, quite simply, one of the best books on programming I have read for a long time.

—Martin Schweitzer, Computing Reviews


The reason it's taken me literally months to get this review done is a reason why you should buy the book: There's just so much value in it that it will take ages for a reader to extract that value.

Every once in a while, a problem comes along that absolutely demands a clever algorithm, because the naive solution requires far too much time or memory. HOP excels at showing you how to solve those difficult problems with ingenious algorithms in crystal clear, reusable code.

—Peter Scott, author of Perl Debugged. (Complete review)


Sehr empfehlenswert: Wie erkläre ich dem Durchschnitts-Perl-Programmierer die Vorzüge der Funktionalen Programmierung. Perl für Poweruser! Aber auch für Nicht-Perl-Hacker ausgesprochen empfehlenswert. . . . MJD ist Garant für 'guten Stoff'.

—Stefan Tramm (Complete review)


The book is fun to read. It has depth; however, it is not written like a text book. Compare it to hacking with friends rather than sitting in a CS class.

—Mike Chirico


Dominus has done it - he's written a Perl book which I Consider to be highly advanced, and he's done so in a style that means you wouldn't notice. If you think you've reached the edges of what Perl can do for you, you need this book right now.

—Simon Cozens, author of Advanced Perl Programming,( 2nd Ed.). (Complete review)


I highly recommend this book and would gladly trade 35% of the technical books that I own for it.

—Jason Perkins (Complete review)


HOP . . . is a text sure to become a classic; it starts with moderately difficult Perl techniques and builds up to possibly the most complex yet enlightening examples I've ever given the chance to melt my brain.

In many years of programming experience, only a few books have enriched my programming skills in every way, as this one has. The others I can think of immediately are Unix Power Tools, the Stevens books on UNIX programming, and of course the several volumes of The Art of Computer Programming by Knuth. These books don't just teach a language, they teach a philosophy and do it well. I hope this conveys my admiration and respect for Mark Jason Dominus and HOP. HOP will stay on my bookshelf for a very long time.

—Teodor Zlatanov, IBM developerWorks. (Complete review)


I picked this up a couple of days ago and timidly cracked it open. The list of topics looked daunting and whenever someone talks about functional programming I get kind of sleepy. Instead I find myself reading it with the same enthusiasm I normally reserve for my guilty-pleasure sf novels. I can't put it down. I read it when I should be sleeping, working, whatever. I need to have my laptop handy to to test variations. I'm playing around with Perl again.

Thanks so much, Mark -- you've kick started an enthusiasm that had faded substantially. Things I've sort of understood (lexical scope -- no one ever told me why it's "lexical" and now that I know it's obvious how and why it does what it does) are now crystal clear. Things I could never get straight in my head are obvious (tail recursion and the loop optimisation of it -- I could never make sense of explanations of this at all, and you scored in a couple of paragraphs). You're a master of explanation. Even my 3 volume set of Knuth is looking less daunting now that you've explained the relationships between DFS, BFS, and recursive solutions. Knuth has all the answers but no matter how hard I banged my head on it it never quite got through. Now it does.

Thanks again. My next company course on Perl will likely use HOP as the text.

—Brad Murray, Vancouver, Canada


It is a twisty, turny maze of wonderfulness, a text (sometimes) about how to write programs that write programs, and will make your brain strong (and possibly drive you nuts, falling down an infinite-recursion hall of mirrors.)

—Randy Kirchhof


Back when I was doing Perl—even for people that knew Perl relly well—I would recommend MJD's Higher-Order Perl. The book is really fun in that it starts somewhat simple and you're like "Yeah, yeah, I know what a closure is." And then it just continues to fuck with your head. By the end of the book, you're just blown away. Even though I knew all that stuff, in theory, just watching it taken to the extreme really changed how I thought. I recommended that to a bunch of my friends and it blew their minds.

—Brad Fitzpatrick


Al índice del Higher-Order Perl le falta un disclaimer "Sólo para machotes"

—Alberto Villegas Erce


It's like the Monty Python song about spam, except instead of spam it's lexical closures, and you do want them.

—Chris Palmer


Order Higher-Order Perl online from Barnes & Noble


Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia | Higher-Order Perl

mjd-perl-hop+@plover.com