Programming Perl by Larry Wall et al.
Larry Wall, Tom Christiansen, Jon Orwant
- 4 minutes read - 777 wordsAuthor: Larry Wall, Tom Christiansen, Jon Orwant
Rating: ★★★★★
Around 2001, I needed to learn Perl. The primary means for doing so was Programming Perl by Wall, Orwant, and Christiansen — and indeed I did learn Perl, and spent an early part of my career using it as the glue language that made all sorts of impossible tasks possible (there are legacy posts recorded here that attest to this).
But the book had three surprising gifts that have stayed with me far longer than the syntax.
- A model for how to teach with a linguistics inflected, recursively absurd humor
- A preview of the wonder of watching a toddler learn to speak
- An absurdist hello-world I have carried into every language since:
razzle
Gift One: A Model for Curriculum
This book taught me in the voice that I’d always wished to be taught in. The authors are funny and irreverent, full of in-jokes and meta-textual asides designed to keep the reader’s attention through challenging material.
For example, in need of an inherently complex data structure in order to
explain the Hash type, the authors (Wall here I’m figuring must’ve been
behind this, a man trained to be a Christian missionary) reach for the
marriages of the Old testament.
Wall goes somewhere absurd and keeps a straight face the whole time. He notes
that “Jacob, as it happens, had four wives — Don’t try this at home.”
Then, having mapped those wives onto a nested data structure, he adds: “We’d
like to pretend that Jacob’s four wives were really one wife. Don’t try this at
home, either.” It’s irreverent; it’s a historical and cultural tidbit both; and it might just help you remember the necessity
of [] versus ().
That funny, warm voice — one that shares abstruse passions without apology — is something I have tried to carry into my own curriculum writing and teaching ever since.
Gift Two: Wall on Toddler Programmers
The second gift is a passage in the preface where Wall describes how people in the early stages of learning a language — absent other facilities, absent idiom — will invent or circumlocute their own structures into service. It’s fascinating at the place of cognitive-linguistic development, but it’s also fascinating in terms of historical development of language in the “word paintings” or “kennings” of Anglo-Saxon. When your vocabulary or grammar is poor, you can “hack around” the deficit by an act of artistic imagination.
He addresses the novice directly:
You can program in Perl Baby-Talk, and we promise not to laugh. Or more precisely, we promise not to laugh any more than we’d giggle at a child’s creative way of putting things.
With a beautiful toddler in my home at this moment, I can attest, these utterances can be surprising, creative, beautiful, and sometimes remarkably expressive. Wall’s tone here is genuinely parental and warm. I hope the curricula I create or help along always have that warmth, even though it may seem tenderly naive through my telescoped timeline of experience.
There’s a lesson too in how to do elbow-to-elbow teaching / support: when the unconventional comes, embrace it. Accept that you’re seeing a zealous attempt at a bamboo ladder when you’re able to build an escalator. Ultimately, it’s an exercise in empathy. Wall modeled that. I have tried to hold onto it.
Finally, there’s a gentle nudge to the naive of whom I’ve just written. Let your ego go. When you can laugh with those laughing with you, you can experience the folly and joy of learning. And that’s how we all get better.
Gift Three: Razzle
For years my hello-world in any new language has been an implementation of
razzle. Wall introduces subroutines with a function that does nothing except
announce that you have been razzled:
sub razzle {
print "Ok, you’ve been razzled.\n";
}
razzle();
The absurdity is the point — it strips away every reason to write a
function except the one that matters: this is how we step into and pop out of
a call stack. I have written razzle in Ruby, Python, Go, JavaScript, and
Rust. It is my first proof that a new language and I can get along.
I’m sure there are temptations to model “basic” or “foundational” mathematical truths like Fibonacci or the Sieve of Eratosthenes. But honestly, razzle is easily understood and can be readily adapted to reveal things like formal parameters, lexical closure, etc.
razzle is good enough.
Conclusion
So yeah, there were many cgi and sysadmin and deployment scripts I wrote in
Perl over the years. I don’t remember them all. But I do remember the deepest
lessons that Programming Perl taught, even if I don’t do Perl programming all
that often anymore.