Recently I’ve been reacquainting myself with Perl. I was once a heavy duty Perl programmer, and used it to write everything from large Web applications to throwaway utility scripts. Over the years, though, I’ve spent more time working with Java, and lately I’ve been investing a lot of my effort in Ruby. Over the past couple of weeks, though, I’ve realized that Perl needs to be part of my day to day life again.
This coincides with a realization that one thing I haven’t been very good at recently is just sitting down and dashing off little scripts to make my life easier. I’ve become so used to designing things and thinking about how to keep them simple, clean, and maintainable that I’ve gotten away from just hacking. Perl used to be my “just for hacking” language, and when stopped writing as much Perl, I stopped “just hacking.” (Call this “Java programmer syndrome.”)
Anyway, what’s occurred to me is that Perl presents a couple of advantages beyond just being a language I like to use.
The first is that Perl is the same everywhere. My MacBook has Perl 5.8.6 installed. My FreeBSD server is running Perl 5.8.8. The Red Hat Enterprise Linux servers I use have Perl 5.8.5. I love Ruby, but it’s not even installed by default under Red Hat Enterprise Linux. Getting the right version of Ruby installed isn’t a big deal when a server is going to be used to host a Ruby on Rails application, but it’s probably not worth the time when you want to write a five line script that cleans up some messy HTML. With Perl you never have to worry about it. The correct version is always around.
The second is that Perl has a massive library of modules available, and most of those modules are widely used and well tested. The current version of Perl includes a large set of modules by default and there are plenty of other modules available if you need them. Regardless of what you’re trying to do, chances are someone has already done it and published the module.
Both of these advantages are marks of maturity, and also of stability. I haven’t been keeping track of what’s going on with Perl 6, and I suspect that’s true of many Perl programmers. Perl 5 was, in essence, finished. It does all the stuff that we’d ever need Perl to do, and the only real way to improve the language substantially would be to make it something that’s not Perl.
I don’t see Perl coming back and taking the place of Java or Ruby on Rails for writing Web applications (at least for me), but I feel like ignoring it completely has been a mistake. For a large class of tasks, Perl is the right tool for the job. Recently I’ve been glad to find that Perl is still where I left it, waiting to help me get things done in a quick and relatively painless way, regardless of which server I happen to be logged into.