Why People Are Passionate About Perl

jarich on 2008-05-09T04:21:59

This is inspired by brian d foy's post asking why people are passionate about Perl. I can't speak for everyone, but I'll share some things I've picked up from others along the way.

Mainframe programmers. We were invited to present to the Capacity Management Group in Sydney, Australia a couple of years ago. Basically they wanted to know what Perl was, and whether it could be useful. They were completely blown away by the fact that it was free (in their world everything has to be paid for) and had filters for EBDIC systems automatically integrated! The idea that they could download thousands of libraries on demand also for free was an added bonus. With thanks to the passion of at least the organiser we've been given a few more speaking opportunities with them.

Shell programmers. We've had some die-hard shell programmers being sent to our courses, and some of them have fallen in love with Perl. They've been used to everything being much more verbose than shell and were delighted that you can get so much done in so little code in Perl.

I am passionate about Perl because it's an easy language to work with. I first learned it because I needed it for a job, and I was delighted at how powerful, simple and often intuitive it is. I like the english constructs: unless, and, not, or. I like the short-circuiting nature of the operators: my $foo = $a || $b || 0; - that saves me so many lines I always have to do in other languages. I appreciate its variable scoping and I like strict. I love the DBI, and even more so the abstraction classes (DBIx::Class, Class::DBI etc). How could I not mention the CPAN? Perhaps Perl's biggest answer.

I know, and program in, several other languages, but they don't compare well. I do a lot in PHP, but there are so many little things that get in my way and slow me down. I also keep littering my code with mys. I do a little in C, but I think most people would prefer Perl to C when speed wasn't an issue, so that's not saying much. I write bash occasionally, but past a few lines I can't stop myself returning to Perl for better error handling and real lists. I have never encountered anything that compares to Perl's testing frameworks.

We taught a friend of ours Perl, he is a very experienced Java programmer. He still writes a lot of Java but he uses Perl to script all the repetitive stuff. ;) I can still remember the expression on his face when we showed him "Hello world". Where was all the rest of the code? He's not passionate about Perl, but he's not passionate about Java either. Maybe programming doesn't inspire him with passion, but I always smile when I he asks me "so how would I do X in Perl?" and I show him a simple, elegant, and short way of doing it; followed with him showing me the awkward, cumbersome way he's been trying in order to get it to work in Java. Sometimes I'm able to offer better Java solutions, but not as often as he's able to improve my Java code.