Feeds

back to article Perl programming language marks 25th birthday

Perl, the open source programming language used by developers and sysadmins to automate any number of text-wrangling and data-management tasks, celebrates its 25th birthday on Tuesday. It was on December 18, 1987 that Larry Wall released Perl 1.0, posting the source code to the Usenet newsgroup comp.sources.misc. Wall had begun …

COMMENTS

This topic is closed for new posts.
Silver badge

You've made my day

Only 25 years old, I must be younger then I think. It seems as if I've been using Perl for ever.

1
0

EXTERIOR: DAGOBAH--DAY

With Yoda strapped to his back, Luke climbs up one of the

many thick vines that grow in the swamp until he reaches the

Dagobah statistics lab. Panting heavily, he continues his

exercises--grepping, installing new packages, logging in as

root, and writing replacements for two-year-old shell scripts

in Python.

YODA: Code! Yes. A programmer's strength flows from code maintainability.

But beware of Perl. Terse syntax... more than one way to do it...

default variables. The dark side of code maintainability are they.

Easily they flow, quick to join you when code you write. If once

you start down the dark path, forever will it dominate your destiny,

consume you it will.

LUKE: Is Perl better than Python?

YODA: No... no... no. Quicker, easier, more seductive.

LUKE: But how will I know why Python is better than Perl?

YODA: You will know. When your code you try to read six months from

now.

18
2
Anonymous Coward

YODA: You will know. When your code you try to read six months from now.

But upgrade to a new (even minor) version of the Python interpreter let's hope you never have to, or evil API changes you will encounter and fix your code you'll be forced to.

2
0
Bronze badge
Happy

>new (even minor) version of the Python interpreter...

>But upgrade to a new (even minor) version of the Python interpreter let's hope you never have to, or evil API changes you will encounter and fix your code you'll be forced to

Yeah, I call BS on this one. Went from 1.52 all the way 2.6, stopping on 3-4 intermediate versions merrily along the way and not that much change that I recall, my programs mostly "just worked". Only reason I am not on 2.7 is mxODBC's usual new version = new license shenanigans. Not saying nothing changed in the module APIs, just that not breaking existing programs seems quite high on the Python designer priorities.

Python 3.x, now that I know has incompatibilities.

Having said that, the Yoda chant OP isn't totally up front either. Sure, you can write crappy Perl that you can't maintain. But look at the use case, and compare it to equivalent Python uses. A lot of Perl is presumably quick automation and hacks. I know that's what I use Python for.

A lot of what I write in Python is under the radar, seat of the pants, "get it working so I can work on my real deliverables" stuff. 2-3 days to solve something that seems solvable but is complex and is started without upfront analysis.

Some of it stinks to high heaven when I look at it later. Even with Python's much cleaner syntax. Agreed Perl's syntax likely makes it very hard to write clean code, but the type of problems it is used to solve also push towards hacky & difficult to maintain code.

Typically, if it is a script that I know I will want to use and reuse, I may very well throw away the first iteration after it gets too messy. Yes, even with tidy, pristine, clean, Python, much as I love it. Thing is, much of the time, the value of a quick automation script is not immediately apparent - what seems useful turns out to be a one shot affair and what seems trivial becomes a valuable new utility. Not conducive to clean code, in any language.

So let's not complain about Perl more than warranted. The tool is not necessarily to blame for the uses that are made of it. A programmer who knows when to use or not to use Perl (or Python or Ruby) is ahead of one who doesn't.

Happy birthday!

1
1
Anonymous Coward

Re: >new (even minor) version of the Python interpreter...

Yeah, I call BS on this one. Went from ...

Well, you obviously speak from experience here but so do I, so the question is: have you been very lucky, or have I been very unlucky?

All I know is that I've had to deal with several core (not modules, mind you) API changes between 2.5 and 2.6, and more recently between 3.1 and 3.2. And of course I really didn't enjoy that (who would?).

1
0
Anonymous Coward

Re: >new (even minor) version of the Python interpreter...

If you want to see how bad it can get, try to update a Zope program a few versions. There is a huge matrix of what version of python needs to go with each version of zope and then there is a huge list of dependancies, many of which are not easy to find on line at all.

1
0
Bronze badge

Re: >new (even minor) version of the Python interpreter...

>try to update a Zope program a few versions

Probably quite true. I also recall that, when I hung out with some of the smarter devs in our local Python User Group, they had had quite a lot of exposure to Zope and not much love for it. Including people presenting themselves as Zope experts. I confess I totally didn't get Zope myself, too complex for me.

I think it may also be useful to distinguish API churn on modules included with the Python distribution from churn on external third party Python python modules. From what you are saying about hard to find dependencies, it sounds like Zope relies on lots of externals.

Good information for me on both posts, does sound like I have been lucky, but then again I don't use that many 3rd party modules, except for mx.ODBC and some Excel parsers. Something for me to keep in mind if I need to build more complex systems - reliance on free externals comes at a price.

0
0
Silver badge

The internet's Cobol?

I started using Perl in the late 90's and still continue to do so, today - though our relationship is by no means exclusive (yes, I do compile other languages). There are better languages for a lot of the stuff I use it for, but no other single language that can do ALL the stuff I do in Perl, with the ease (through familiarity) and third-party additions I can simply install.

Perls greatest benefit is CPAN. If any language wants an example of how to make libraries integrate with little effort for the user and less fuss they should sit back and watch as Perl modules automatically download, work out their dependencies, download them without further help, build the whole mess, test it's installed properly and then let you get on with your job..

The code may look ugly, it may not have a de-facto IDE, it may be interpreted, you do need to use semi-colons all over the place. But it's well documented, there are plenty of examples (mostly working!) and it's easy to get started. Here's looking forward to another 25 years.

10
0
Pint

Re: The internet's Cobol?

What's wrong with semi-colons?

0
0
Silver badge

Re: The internet's Cobol?

> What's wrong with semi-colons?

Absolutely nothing at all. They're concise and give a clear visual warning where the end of a statement lies.

Now, if we were to start talking about requiring levels of indentation .... <ducks, runs away>

3
0
Thumb Up

Re: The internet's Cobol?

Perls greatest benefit is CPAN. If any language wants an example of how to make libraries integrate with little effort for the user and less fuss they should sit back and watch as Perl modules automatically download, work out their dependencies, download them without further help, build the whole mess, test it's installed properly and then let you get on with your job..

Sounds like Maven.... :)

1
2
Happy

"My vision of Perl's future is that I hope I don't recognize it in 20 years."

It's Perl - that's practically guaranteed, isn't it?

7
1
Meh

Occasionally?

I always describe Perl as "write-only". I also tell people that you can just type "perl " and hit your head on the keyboard a few times - Perl will still execute it.

However the speed it gets through hundreds of megabytes of text files is just amazing. I just don't use it often enough to like it.

5
1
Anonymous Coward

Re: Occasionally?

Just because Perl allows people to write unmaintenable code doesn't make it an unavoidable "feature" of the language. Anyone with enough discipline to be called a half-decent programmer can and will write perfectly maintainable Perl code.

As much as craftsmen like to accuse their tools, in the end it's always their fault for not using a tool properly.

8
0
Bronze badge

Re: Occasionally?

While I agree that it's possible to write readable, maintainable Perl, the language certainly doesn't do much to encourage it. It's possible to write readable, maintainable, safe C, too - I do it every day - but the majority of C programmers don't, because the payoff matrix doesn't favor it (you're more likely to be rewarded for quickly producing lousy code than for slowly producing good stuff). The same is true of Perl.

As much as craftsmen like to accuse their tools, in the end it's always their fault for not using a tool properly.

This is one of those pieces of common wisdom that utterly fails to withstand even cursory critical reflection. There are plenty of bad tools out there, and they deserve to be blamed when they're at fault. (Sometimes the user is also at fault for deciding to use that tool, but often users are victims of outside constraints.)

2
0
Pint

Aaahhhh Perl ....

I once described it to someone as being the 21st century's answer to FORTH.

Granted, I don't use it as much as I used to now but if you need to process a lot of text in a hurry it's pretty difficult to beat. Ditto if you need to hack together a one-liner.

Raising a glass to the Pathalogically Eclectic Rubbish Lister :-)

2
0
Anonymous Coward

Good old Perl, did me no harm

Got my first job importing stats spreadsheets from the 2001 Census into a local Council's spangly new local information portal. Except the data formats weren't the same. I was expected to copy-paste them all (hundreds of them) and upload.

Two Perl scripts later and I'd done the work in about a tenth of the time it would have taken otherwise, and spared my sanity. It also got me my next job as a proper coder (albeit doing .NET, but languages aren't important if you can program). Perl + regular expressions was exactly the right language for quick, effective, flexible text processing - long may it continue.

8
0

Better Than You Think

I'm a dyed-in-the-wool C developer. I like C++ and dabble in Java, too. But professionally I've been using Perl for most of my tasks since I picked up the language over a decade ago.

Even now things I have come to take for granted from Perl are lacking in modern languages - a WWW::Mechanize for C#? How about truly flexible regular expressions and a means of expressing them over multiple lines? How about specifying string constants over multiple lines?

Perl has curly brace support - something that, for me, puts it so far in front of Python and similar white-space-format-dependent languages. If you need to mash everything up on one line in Perl YOU CAN! If you prefer your well indented forms YOU CAN! Many languages keep telling you "YOU CAN'T" - Perl is an enabler - not a denier!

This idea that Perl is a write-only language is rubbish. I've seen garbage written in every language. Just because Python forces you to indent and Java forces you to wrap everything in exception handlers doesn't mean the code is easier to understand! Good Perl developers write good understandable code - including well thought out variable names, comments, and POD (in-code documentation for Perl).

How about test harnesses? Almost all Perl modules available in the standard build and on CPAN come with test harnesses. I can't think of many projects or languages that are as thoroughly tested - or make testing as easy - as Perl.

Ignorance is aplenty in the Internet world. Perl is pretty easy to pick up - especially if you read Larry Wall's wonderful Camel book (he's a great entertaining author) - and has capabilities that stretch from satisfying the most basic of user to the more experienced. But it allows you to hang yourself and others - so self-discipline really shines in the Perl community!

7
2
Silver badge

Re: Better Than You Think

Not used perl - was put off learning by the disgusting syntax. Better is worse etc. However, to address your points, I'm not sure regexps should be in a modern language except as a library. I'd also say from experience that regexps can be a bit too 'lazy' - for complex matching, some manual work will produce much faster text processing than regexps (at the cost of more programmer time). This is often IMO a good tradeoff. If it's one-off or occasional glue then yeah, perhaps.

Emacs can match multi-line patterns fyi and elisp is certainly a language.

WWW::Mechanize? Interesting, judging by a quick google, I'll look into it. I use stuff like cURL & wget although I don't know if these are in any way comparable. There is a language like Expect but I've never used it.

As for multiline constants I think that's a fairly trivial requirement.

0
1
Megaphone

Re: Better Than You Think

Well, Anon, if you branched out more you might know that Mechanize and its variants are available for nearly all current languages, all of them have multi-line string constant support, and multi-line regex via PCRE. (We all owe Perl that much.) Curly-brace vs pretty-indent is purely a stylistic choice. To be honest, choosing a language these days is more about your personal coding style than features anyway; every languages has the features, but they all have wildly different styles and quirks.

Heck, Perl in particular has both the old style unreadable, unmaintainable special variables, where it got the reputation for being indistinguishable from line noise in the first place, and the much nicer new named variables. You're given the choice to be a hacker or a polite coder now.

@BlueGreen, Mechanize is actually mostly a module to massage broken crufty HTML into a good clean DOM, which you can then run XPath or other queries on; the actual form-filling and browsing functionality isn't often used. It's basically a browser's "quirks mode" available to regular programmers.

0
0
Silver badge

Re: Better Than You Think -- @foxyshadis

If it can reliably clean up HTML as you say, it may be worth a very great deal to me. I'll def take a hard gander. HTMLtidy isn't bad but hardly infallible.

Thanks.

0
0
Thumb Up

I love perl. That is all.

2
0
Pint

The Gaffa Tape of the Internet

I've used Perl for 30 of its 25 years I've written one-liners, admin-scripts, CGI-scripts, mod_perl, site specific modules to ease writing of scripts and one-liners.

Perl as a scripting language and Perl as a programming language have different de facto standards now (goggle Modern Perl). You have the choice of writing a maintainable documented program or module, or a one off unintelligible tool to parse the data in front of you, you can also produce anything between, and use any coding paradigm you're comfortable with, this level of flexibility in a language is unmatched in my experience (see Schwartzian transform, Perl with a Lisp), this is probably due to Larry's background in human linguistics.

Many of my one liners have grown into scripts and subsequently into modules for re-use and while most of my coding is in Java @ the moment I still use Perl on a regular basis for everything from administration to log analysis.

The low barrier to entry of Perl has perhaps led to its reputation as a write-only language, however once the coder stops trying to write awk,sed or c and learns to write in Perl's own idioms the unmaintainable aspect of their code disappears.

To the next 25

5
0

Re: The Gaffa Tape of the Internet

Argh 20 of its 25 years, ... must proof read (or post often enough to earn a right to edit posts badge :( )

0
0
Vic
Silver badge

Re: The Gaffa Tape of the Internet

> Argh 20 of its 25 years, ... must proof read

I thought you were just claiming overtime rates :-)

Vic.

0
0

A perl program I wrote

And I've run it every year for the last 14 to format my Christmas card address list into labels - 3 columns per sheet of 24. Perl was much better than shell scripts for more complex tasks, now superceded by Python for the kinds of work I used to use it for.

0
0
Silver badge

Perl

The "more than one way to do it" thing is great but includes bad ways too. Unmaintainable ways. So like every other language, the key is to keep things as elegant and maintainable as possible. Perl is strongest at doing what it was originally designed for, an admins language to supercede sh and awk. If you use it to write video games, don't moan if the code turns out cr*p.

As an admin, I love it, but improvements could be made - please make references not look like ordinary scalars, please eliminate some of the ultra-subtle failure mechanisms around auto-vivification, and just for kicks, can we have a snappier way to open files, without the ugly syntax ?

@PyLETS - Tempted to automate your Christmas cards ? Just say No! Some things must be unsullied by the digital hand.

0
0
Silver badge
Devil

Re: Perl

Not to mention .... THIS!??!

$? : The status returned by the last pipe close, backtick (`` ) command, successful call to wait() or waitpid(), or from the system() operator. This is just the 16-bit status word returned by the traditional Unix wait() system call (or else is made up to look like it). Thus, the exit value of the subprocess is really ($?>> 8 ), and $? & 127 gives which signal, if any, the process died from, and $? & 128 reports whether there was a core dump.

At some time, someone must have thought it good style to inject bit diddling into a glorified report processor

0
0
Bronze badge

Re: Perl

I'd guess that the vast majority of early Perl programmers would have expected precisely that behavior - the $? operator returns the wait(2) status. That's what it does in the languages Perl was designed to emulate, such as sh. To have it do otherwise would have violated the Principle of Least Surprise.

There are plenty of things to pick on in Perl, but I don't think this is one of them.

0
2

Re: Perl

Errmmm .. in sh $? returns the exit code, not the the wait(2) status.

Perl's decision is very surprising for shell programmers.

1
0
Bronze badge

Re: Perl

Does it? In Cygwin bash, $? gives the wait(2) status:

$ cat

^C

$ echo $?

130

and I thought (from memory) that was Bourne-shell-compatible. If not, then that's my fault for not testing it. Apologies.

(Note 130 & 127 is 2, which corresponds to SIGINT, which is what I currently have ^C mapped to.)

0
0
Bronze badge

used it for years

The amount of time saved, for me and for those I work with, has been just astonishing. About the first thing I will do at the office this morning will be to write yet another Perl script to make another tedious job quick and easy.

0
0
Bronze badge

Yar - what everyone else said

For years I have enjoyed Perl programming but felt guilty about my shameful text-munging habits.

Now, reading this comments page, I feel finally able to come out.

0
0
Go

laziness, impatience, and hubris

amen to that

0
0
Holmes

Pathologically Eclectic Rubbish Lister

Given garbage in is the norm this is inevitable.

0
0
Thumb Up

Raising a glass from the Windows side of da house

A pint to Larry, and a chaser to ActiveState and Strawberry for solid Windows ports. I spend a lot of my days in Windows noodling around spreadsheets and having Perl to do the things that Excel can't or won't do without ridiculous amounts of chicanery is a lifesaver. Export, munge, import, job done.

0
0
Thumb Up

Got my degree thanks to Perl!

I coded in Pascal, C and C++ on my Computer Science degree and when I got through to my final year project (a long time back now) I remember my tutor saying that there was this language (just coming up to 9 years old) that he wanted me to write my final project in.

(There wasn't much CGI programming out there). I wrote a couple of Perl scripts and wrote a web based application to handle classroom assessments which looked lovely in Mozilla. I got an A for it and the staff were that impressed with it that they tried to sell it on.

0
0

Happy B'day, Perl!!!

I've been using Perl since the late '90s, ever since I was "baptized by fire" by a boss giving me a text-processing/CGI task, handing me the Camel Book, and demanding that it be completed in 6 days.

I discovered, to my amazement, that the book read so pleasantly from start to finish; a testament to Mr. Wall's wit and literary prowess. To my further amazement, I discovered that Perl, too, was a pleasant tool to work and play with--again, testament to Mr. Wall's background and experiences.

I love Perl. I particularly adore its two most important features, in the words of Tom Christiansen: "getitdoneness" and "whipituptitude."

Happy Birthday, Perl! Here's to another 25!!!

dZ.

0
0
Bronze badge
Boffin

Only 25 years?

I'll swear I once saw a module in CPAN called Universe, the new method took arguments c, G, h, ε0, e and a boolean value for evolution. There was a warning that memory requirements often grew quickly.

0
0
Bronze badge
Go

Yes happy birthday indeed!

A suitable present for a 25th might be a necklace, a Perl necklace maybe.

0
0
Anonymous Coward

to the next 25!

Perl scripts using perltidy and perlcritic are at least as readable as {insert your favourite scripting language here}. Just map a key in your editor to run those every now and then and it will tell you where the problems are.

Those spreading that rubbish about it being write only and stuff must have stopped using it during the haydays of 'matt's scripts archive'. A lot has happened since those days. Inform yourselves better or STFU. I don't like you either ;-)

Perl is also surprisingly nice in Windows, it runs plenty of tasks at $work. Plus the more I look at powershell, the more I chuckle. Those guys have nearly written a Perl shell ;-). Lots of similarities, so writing powershell scripts makes the Perl scripter in me feel right at home.

Still, for data munging, log parsing, network tests, nagios plugins and that sort stuff, Perl is the first choice because it is way faster than powershell and costs less in system resources. And yes CPAN is amazing.

It may not be the sexiest or the coolest, but it sure gets used a lot.

1
0
This topic is closed for new posts.