Perlish Wisdom
Here’s an interesting article in which Curtis Poe explains why there’s a shortage of Perl programmers on the market at the moment. I’m not qualified to comment on whether the shortage exists or his analysis of it is correct, but I certainly wouldn’t fancy maintaining Perl code. The Perl mantra, “There’s more than one way to do it”, appears to be liberating but all too often results in unnecessary inconsistency. I prefer Python’s “There should be one — and preferably only one — obvious way to do it”.
That said, I do have a soft spot for Perl. It was the first very high-level language I fell for. This was at a time when I routinely worked on different flavours of Unix and Windows machines; and I routinely had problems with the different environments. There wasn’t even a command shell which worked well across the board. Perl effectively gave me a platform independent way of writing scripts to perform simple file, text and job processing.
I say “scripts” rather than “programs” because I never wrote anything more than a few dozen lines long. I never had to go through the tiresome business of compiling, sorting out dependencies, locating include- and library- paths, declaring object types – tasks which I’d always associated with real programming.
Scripting was more direct, more fun.
A few dozen lines of Perl easily accomplishes as much as a few hundred lines of C. In fact, one line of Perl can get a surprising amount done. Surely the performance of an interpreted language would be a problem? Maybe it can be, but time after time, I was impressed just how quickly Perl allowed me to chew through data.
I had to admire the way the language grabbed all the characters on the keyboard and squeezed the juice out of them. It even allowed variables to dissolve away into defaults which you could then omit and which, as if by magic, did just what you wanted: $variable
, $_
, .
Ultimately, though, there were things I never quite got and probably never will get. I never managed to build complex structures without referring to the manual. Oh, and I never really got to grips with the Perl documentation system. I never found an editor mode I was completely happy with — or perhaps the overloaded syntax just started to grate. Finger saving tricks turned out to be expensive in the long run.
Adopting Perl changed me, though. I prefer powerful languages with comprehensive libraries. Wrestling with build systems seems too much pain for too little gain. And explicit type declarations make software frigid.
Feedback
-
Funnily enough Perl was the language that got me back into programming after a long period away from it (as an academic linguist/psychologist). The flexibility and things like 'implicit' variables reminded me of human languages; I felt very comfortable and could get a lot done. I only moved over to Python at a client's insistence: I was rather sniffy at first but I've never looked back.
I should also say I've never looked forward either. I keep meaning to learn C++ and start using that (I joined the ACCU, I've worked through Accelerated C++, I yearn for static typing), but python is just too comfy.
-
Have you ever tried Ruby? I'm interested in it (I'm interested in any high-level language) but haven't used it much. It's clearly strongly influenced by Perl.
... reminded me of human languages
Hah! I get what you're saying about the implicit variables, but suspect part of Perl's appeal is that the scripts can be unreadable to the uninitiated.
implicit variables.
I guess I've come to prefer the Pythonic "Explicit is better than implicit".
-
I've worked a little with Ruby - just maintaining already-existing scripts. In some ways it feels like a Perl redesigned from scratch - a refactored Perl maybe. Ruby's existence makes the prospects for Perl 6 look even darker.
Ruby looks a bit clunky and ugly to me but I have a very good friend who has otherwise impeccable taste who loves php & Ruby, and thinks Python is overblown. Maybe it depends where you're working (he's a web developer).
I will slag off Perl till the cows come home, but it has a permanent place in my heart. I remember an article in the old Perl Journal about a haiku generator written in Perl. Not only did the script generate haiku, but the script itself and the entire article were written in haiku too. If Perl goes, I hope there's still a home somewhere for that spirit of creativity for its own sake.