Higher-Order Perl

by Mark Jason Dominus

Order Higher-Order Perl online from Powell's Books

Download full text here

There are three versions available. You have your choice of structure or presentation, but not both.

License reminder

Higher-Order Perl is copyright ©2005 by Elsevier Inc. Unauthorized reproduction or distribution is absolutely forbidden.

You may download the book for your personal use, but you may not distribute it to other people, either individually or by uploading it to a file-sharing service.

Although the text is available for free, Higher-Order Perl is not in the public domain and is not available under a free license of any sort. I distribute it from this web site by virtue of special permission from the publisher. You, most likely, do not have any such permission. If you distribute the files, you will be violating not only the law but also my personal wishes.


This is the publisher's own PDF proof of the second version, which was sent to the printers in August 2005.

This is better than the bootleg copies available from download sites in at least three ways:

Download the whole book.

**NEW** Reformatted with less marginal whitespace for mobile devices. Thanks to Joe McMahon for providing this version.

Download individual chapters

  1. (Front matter)
  2. Recursion and Callbacks
  3. Dispatch Tables
  4. Caching and Memoization
  5. Iterators
  6. From Recursion to Iterators
  7. Infinite Streams
  8. Higher-Order Functions and Currying
  9. Parsing
  10. Declarative Programming
  11. (Index)

How was this created?

I wrote the book using a markup language I programmed myself, called MOD, which you can see in the next section. I translated the MOD to HTML and sent HTML to the publisher, Morgan Kaufmann. As you should imagine, the HTML contained very little in the way of layout and typesetting instructions.

The typesetting company hand-translated my HTML to LaTeX, which they formatted and processed with LaTeX style files provided by the publisher. The interior layout and design, including creation of the style files, was done by an unsung genius named Julio Esperas, an employee of Morgan Kaufmann. If you think the interior of the book looks good, as I do, Julio Esperas is the person who deserves the credit.

The interior illustrations were created by a company called Dartmouth publishing, from my hand-drawn originals. There were several exchanges back and forth in which I told them to make the lines in the tree diagrams curved instead of straight, to make the clouds fluffier and the parabolas more elegant.

The cover was designed by a freelancer named Yvo Riezebos.


These are the original sources that I used to generate the manuscript draft that I first sent to the publisher. They are written in MOD, a variation on the "pod" markup in which Perl's documentation is written. It should be self-explanatory. If not, drop me a note.

The big drawback of this version is that it not only omits the corrections that were added between the first and second printings, but also the much more significant corrections that were added before the first printing.

The big advantage is structural markup and tests for the code.

Download the whole book.

Download individual chapters

  1. Recursion and Callbacks
  2. Dispatch Tables
  3. Caching and Memoization
  4. Iterators
  5. From Recursion to Iterators
  6. Infinite Streams
  7. Higher-Order Functions and Currying
  8. Parsing
  9. Declarative Programming

For the index, go here instead.

MOD package

MOD was complete enough for me to write a book, but it is still incomplete. If you're feeling adventurous, you can download the source code. It is written in Perl.


Order Higher-Order Perl online from Powell's Books

Return to: Mark Dominus blog | What's new page | Perl Paraphernalia | Higher-Order Perl