rc3.org

Strong opinions, weakly held

My old friend Perl

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.

5 Comments

  1. Hi,

    It’s kind of reassuring that you wrote this post because I just went to look for your “guestbook” example from your old book learning cgi in 24 hours and I went to your main page.

    I am also encouraged that maybe someone out there has already written code for what I need: to access a comma delimited file, take info from it and then use that info in simple linear equations to come up with first guess weather forecasts.

    Thanks for your book.. I am hoping to get this prog up an running by the end of the week… if that’s possible… AHHH!

    go perl!

  2. Hooray for Perl!

  3. You may just want to take a look at Catalyst for a Perl MVC framework that’s not opinionated (and much more flexible than Rails)… or Jifty for one that is. Time hasn’t stood still in Perl-land, no one uses bare CGI.pm any more.

  4. @Dave — perhaps Text::CSV (http://search.cpan.org/~alancitt/Text-CSV-0.01/CSV.pm) is what you’re searching for?

  5. @Dave – you’ll find that the CPAN has almost anything you could possibly need. I remember someone on perlmonks having a signature something to the effect of “90% of every Perl application is already written”. Giving props to the extensive list of reusable modules residing on the CPAN.

    @genehack – I’d recommend Text::CSV_XS . Faster than Text::CSV and still actively maintained.

Leave a Reply

Your email address will not be published.

*

© 2016 rc3.org

Theme by Anders NorenUp ↑