I owe a whole lot to Perl. So does the practice of computing in general, and the construction of the Web in particular. Perl’s situation is not terribly happy; I wouldn’t go so far as to say “desperate”, but certainly these are not its glory days.

Herewith some thoughts on Perl’s place in history, and how a tiny piece of it bit back at me at OSCON this week.

History · Perl proved a bunch of things that now seem obvious but, a couple of decades ago, would have seemed unlikely and in some cases unbelievable:

  • You can get serious work done in a language without requiring a compilation step. In other words, a “scripting language” is a perfectly OK thing to be.

  • You can get serious work done in a language that allows the programmer to say very little about the type of data items.

  • Content-addressable stores (hashes, dictionaries, whatever you call them) are basic to doing, well, anything; they should be built-in to languages, with a convenient readable syntax.

  • Regular expressions make many tasks easy which would otherwise be difficult; they should be built-in to languages, with a convenient readable syntax.

  • It is unsurprising when a powerful general-purpose programming tool is an open-source construct.

  • It is unsurprising when a powerful general-purpose programming tool includes a vast repertoire of high-quality libraries constructed by a global community of volunteers.

  • A large proportion of all computer programming consists of string manipulation. As a consequence, languages which have high performance in string processing will be perceived as fast.

Yes, there were other languages with some of these characteristics before Perl. But Perl had all of them and went from an obscure sysadmin tool to the glue that held the early Web together in what seemed a matter of weeks. It taught us a lot of lessons. Which means that its author Larry Wall taught us a lot of lessons, and we all owe him a vote of thanks.

Perl and Me · The text you are now reading has been prettified for your benefit by a large glob of Perl code; this blog’s infrastructure may not be pretty, but it’s largely bug-free and pumps out hundreds of GB month without ever sneezing. Thank you Larry!

Also, in my career I have written two rather large-scale (as in, they harvested billions of pages) Web crawlers, one which in a certain sense made my fortune. Both were implemented in Perl and I found it a highly-appropriate tool for the job. I remember with a certain vindictive glee the doomed pathetic thrashing of the follow-on project; someone with Enterprise Experience decided that my pathetic amateurish Perl crawler should be replaced by a properly-architected Java version.

Recent History · It hasn’t been that kind to Perl. Many people, for example me, have moved on; largely to Python and Ruby, even though they are neither faster nor equipped with better libraries or documentation. I think this process carries two uncontroversial lessons which nonetheless bear repeating:

  • Object-Orientation is good.

  • Readability is important.

Yes, I know that Perl can be written in an object-oriented and readable way. And most of all, that Perl remains in wide use and highly relevant in all sorts of situations. But I think the lessons remain valid.

The Ribbon Thing · At conferences there are badges and on badges there are ribbons, often with labels such as “Sponsor” or “Speaker” or “Chair”, designed to make their bearers seem more important. At OSCON, there are ribbons, but anyone can have as many as they want; a bunch of preconfigured ones are provided and there are facilities for customization. Here are mine.

Tim Bray’s OSCON buttons

The Ruby ribbon is truncated because it read “Ruby Rockstar” and I’m not one of those. Note the turquoise one reading “Desperate Perl Hacker”; It turns out that, a long time ago in a galaxy far away, I coined that phrase.

The year was 1996 and the XML co-conspirators had plenty of experience with the relative ease of wrangling large datasets in open textual as opposed to closed binary formats. The narrative was something like this: A Vice President with his hair on fire runs into a hacker’s cubicle saying “We have to change all appearances of ‘Soviet Union’ to ‘Russian Federation’ in the whole legal-publications suite and support system and there’s no time and no head-count! We’re doomed!” But the Desperate Perl Hacker triumphs, because the data is in transparent text files. The D.P.H. was repeatedly invoked during the XML design process to support this or that simplifying feature.

Here’s the sad part: Parts of the community at this year’s OSCON deemed the D.P.H. ribbon inappropriate in view of Perl’s somewhat beleaguered status, and it was no longer on display by the time I got there. I managed to obtain one from a plain brown envelope with a bit of nudge-nudge wink-wink, and I wore it with pride.



Contributions

Comment feed for ongoing:Comments feed

From: Avi Bryant (Jul 23 2010, at 18:04)

That Desperate Perl Hacker story reminds me unavoidably of this XKCD comic, complete with {Perl!} comic-book-splat-thing (what are those called, anyway? they must have a name): http://xkcd.com/208/

[link]

From: kar (Jul 23 2010, at 18:15)

Hmm - I picked up about a dozen (we're a Perl company) by the simple expedient of walking up to the counter and asking for them. I got a comment to the effect of "we're glad you appreciate the joke" from the person in question.

[link]

From: Eugene (Jul 23 2010, at 19:15)

We still use Perl at work to do a lot of scripting and I use Perl in my hobbies. I guess I'm also a desperate Perl hacker.

Now can we have production-level Perl 6 already?

[link]

From: Joseph Scott (Jul 23 2010, at 21:17)

I have wonderful memories of Perl. It made developing on the web fun and exciting, everything that writing CGI code in C wasn't.

[link]

From: Jerry H. (Jul 24 2010, at 00:29)

The "desperate perl hacker" badge bothered me far less than the "ruby rockstar".

[link]

From: Paul Downey (Jul 24 2010, at 00:55)

I'm proud to still hack in Perl. It's a great language for quickly getting things done, in particular one-off knife an forkings of text, which is the basis of most of my fumbling with data.

Had I attended OSCON, I would have sported "desperate" with pride. It must have been a great conversation opener, the main reason to go to conferences!

I'd have eschewed "rockstar" too, but self-deprecation is tricky, and reminds me of recently meeting americans at a family party, being asked what I do and my saying "I mess around with computers". They looked at me pitifully and then remembered their 20 year old cousin: "He's good. He works in IT. He builds his own computers. Bob can show you a thing or two, maybe Bob can help you get on" .. sigh ..

[link]

From: Gabor Szabo (Jul 24 2010, at 05:00)

I am not sure how you reached that specific conclusion and lesson (readability and OO) but then I guess the release of Perl 6 will bring a lot of Python and Ruby programmers to start using Perl.

Or will there be a "no it is still perl" sentiment, no matter what?

[link]

From: oozie (Jul 24 2010, at 07:55)

TMTOWTDI, but the way to do it best can be only 1.

[link]

From: Unixmonkey (Jul 24 2010, at 07:55)

I spent a lot of my early programming days enjoying, but silently holding a grudge against Perl because of the awful codebase I was maintaining.

A *lot* of code out there predates current good practices such as object-orientation, non-global variables, and use of descriptive functions; and that's probably most of what you'll see if you search for a problem with google by pure virtue of "ugly" or "bad" code being in the majority.

As helpful as they were at one time, tutorial sites and code forums are stuffed with old garbage, and the internet never forgets.

Those new to programming undoubtedly do a side-by-side comparison of language constructs and community, and you can't tell me that even good Perl looks better than bad Ruby or Python. Also, a lot of perl community sites such as CPAN & perlmonks look very clunky in a 1997 kind of way. Fair or not, it gives the impression that the tool used to make those sites is also clunky.

I have a lot of hope for Perl as the number of smart Perl hackers out there is very high, however most of them are in system administration and devops rather than web and software development in general.

Perl6 is doing a lot of things right, but if Larry doesn't stamp "Finished" on it very soon, it may cease to matter entirely.

Perl's adoption today has little to do with its power, and more to do with you being able to depend on it being installed on any unixy system.

[link]

From: Lev Piaseckyj (Jul 24 2010, at 12:58)

Tim -- This xkcd goes far *beyond* the flaming-hair VP in illustrating the usefulness of Perl.

http://xkcd.com/224/

Don't miss the zinger in the img's title attribute.

[link]

From: Preston L. Bannister (Jul 24 2010, at 13:20)

Was using Perl recently to cobble together the server-side of a demo for a small web application. Had forgotten what a \&@%$pain Perl is for non-trivial data structures.

Went to check up on Perl6 and Parrot. Sad.

For all practical purposes, Perl6 is already here, and is called Ruby.

Yes, I know all the obvious arguments about code and library compatibility. Yes, I know the "we will do it better" pseudo-argument. Perl6 and Parrot have all the earmarks of lost projects. Even if they do arrive - someday - there is no longer any large value. Ruby sits where Perl6 might have once fit. (The fact that Ruby gives credit to Perl is exactly appropriate.)

Though - in place of Perl - I am tempted to skip Ruby, and go straight to server-side Javascript. Maybe that is just me. :)

Tim, your history strikes me as a little off, but perhaps that comes from a slightly different perspective.

Larry Wall did an excellent job. He distilled well-proven lessons from Unix into a (often) faster, easier to port and distribute package. The notions of data as text, composable tools, scripting, use of regular expressions - were all well proven. The early heritage is exact, but Perl offered a nicer package, and got a wider audience.

(I will offer a side-bet. Most folk who learn shell scripting well, transfer to Perl easily. Most folk who write Perl have small exposure to Unix scripting. Thus Perl looks like a first-proof to most.)

Just as XML was a re-presentation of an old well-proven notion: data as text, representation of domain-specific data in a sufficiently-rich common form, which allows for a common reader/writer, which in turn allows for composable tools. All this was an obvious lesson from the use of Lisp to build domain-specific languages. (Though I am unclear whether the original XML folk were aware of the lesson from the Lisp community.)

Both Perl and XML took learned lessons to a larger community.

[link]

From: Paul Bartlett (Jul 24 2010, at 13:50)

In a previous job (life?) Perl saved me on a couple of occasions, both when needing to do one-off transformations of large volumes of PCL print output. Only a performant (w.r.t string processing) scripting language could have done met the business constraints (combined dev time and runtime had to be a matter of hours), and the fact that only myself and the sysadmin knew what the script did was fine - as the two of us were sure *exactly* what it did.

These days my day job is using Java, but I've been playing with Scala and have high hopes for it (not least as it's the only other language I know which is both "serious" and proud of its scriptability - scaling down as well as up is seriously underrated). And if not maybe Clojure, in which case I'll invest in any company producing spare parens keys :)

- Paul.

[link]

From: Steven Bedrick (Jul 24 2010, at 15:22)

I was somewhat disappointed by how few of the people at OSCON seemed to get the DPH reference. I was further dismayed to note that so many of the people who didn't get the joke instead assumed that the conference organizers would intentionally insult a large segment of the attendees...

That said, I also thought that the "ruby rockstar" tag was more than a little bit tacky. Tim, I liked your solution to that particular problem...

[link]

From: kl (Jul 24 2010, at 15:24)

I've tried to learn Perl, and quickly dumped it with distaste.

Type of variable (hash, etc.) dependent on prefix? And that prefix changes depending on context?

Can't just simply pass arguments to function? Can't pass nested hashes? WTF?

I concluded that basic blocks of the language don't work in sensible manner.

[link]

From: Kevin Scaldeferri (Jul 24 2010, at 16:39)

Steven (and Tim), I don't think people thought the organizers _intentionally_ insulted a group of the attendees. But the fact is that they unintentionally insulted them. The joke fell flat, perhaps because it apparently referenced a 14-year-old meme, and I would say that some sort of apology is probably due, which I didn't hear at any point during the conference. Comments like your are essentially blaming the offended parties for being offended because they haven't been part of the perl community long enough, or don't know their history well enough, or what have you. I don't feel like that's okay.

[link]

From: Tony Fisk (Jul 24 2010, at 17:59)

Tools come and go, particularly in a relatively young profession like computing (There! Hope that makes you feel better!)

I came upon scripting languages relatively recently (as in ~ 5-6 years ago). For those interested, my development is laid out here.

(Umm... what was the python ribbon?)

[link]

From: Roger Rohrbach (Jul 25 2010, at 05:08)

'twas awk that proved the value of content-addressable stores and regular expressions. You could get serious work done in awk, but not without some serious work, which is why Larry Wall created Perl.

[link]

From: Andrew Jones (Jul 25 2010, at 13:24)

I am surprised no one has mention Moose yet, which makes OO programming in Perl easy and very readable. See the code sample at http://www.iinteractive.com/moose/about.html.

[link]

From: Robert Young (Jul 25 2010, at 14:47)

-- 'twas awk that proved the value of content-addressable stores and regular expressions.

thank you. these young-uns know not of which they speak. and all that psuedo-geek babble extolling the wonders of xml in CS, baloney. SGML, from which xml is a straight derivative, was built by LAWYERS. get real folks.

[link]

From: John Hart (Jul 25 2010, at 17:13)

kl wrote:

[QUOTE]

I've tried to learn Perl, and quickly dumped it with distaste.

Type of variable (hash, etc.) dependent on prefix? And that prefix changes depending on context?

Can't just simply pass arguments to function? Can't pass nested hashes? WTF?

I concluded that basic blocks of the language don't work in sensible manner.

[/QUOTE]

The first point (regarding prefixes - $, @, %) is true, and is one of the primary causes of readability issues with Perl.

The second point is incorrect, so I'm guessing that you didn't invest more than 30 minutes trying to learn Perl (15?). Perhaps the lack of C-style function signatures threw you off.

sub foo {

my ($num, $hash1) = @_;

my $hash2 = $hash1->{b};

print "$num: $hash2->{a}\n";

}

foo(2, {a => 1, b => { a => 'v2' }});

Almost exactly like javascript, except the argument declaration moves inside the function block. Moving that declaration out of the language and into statements is actually quite powerful, because it lets you do some things that would be difficult otherwise (or would require their own special syntax in the declaration line ... variable-length arguments, for example, which didn't even exist in the first 5 years of Java).

Perl has a couple issues, readability foremost, but the variety of ways you can do things in the language is remarkable. It's nice to be able to adopt radically different paradigms within the same language.

And, if you know Perl, you can read Mark Jason Dominus's book "Higher Order Perl," which makes you a better programmer in any language.

[link]

From: Hercynium (Jul 26 2010, at 18:57)

@oozie: so, you've effectively solved the Halting Problem and proved that??!? ;-P

In some particular contexts a particular problem may have one "best" solution (FSVO "best") but I find that code that assumes "everything is a nail" is often the worst of all.

I suggest you look up TIMTOWTDI BSCINABTE for the full story!

[link]

From: Kevin Spencer (Jul 27 2010, at 15:36)

If you haven't seen it already, I'd recommend reading Piers Cawley's a tale of two languages.

[link]

author · Dad
colophon · rights

July 21, 2010
· Technology (90 fragments)
· · Coding (98 more)
· · Dynamic Languages (45 more)

By .

The opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.

I’m on Mastodon!