Five things to like about Perl

It’s been a while since I blogged, huh? Look, I never said I was reliable.

If you’re like me, you thought programming was for nerds until the year 2000, when you were surrounded by a bunch of nerds you liked, and then you gave in and admitted you were not-so-secretly a nerd all along and discovered you actually like programming. If that’s the case, you were probably raised to believe that Perl is evil. I certainly was. I heard all of the lousy things about how it’s totally unreadable, and how the variable scoping is weird and kind of leaky if you’re not careful, and how the subroutines are completely not self-documenting, and how it’s totally unreadable. Then I took a job that required me to learn Perl, and while I still don’t love it, I’m making an attempt to embrace new things and not become one of those people who is totally set in her ways and completely resistant to change of any kind. That’s a good thing, right? So, to that end, I give to you a list of things to appreciate about Perl. Read it before you go hatin’:

  1. Regular expressions support. Okay, this is the easy one. If you need to parse a string (or, say, a log file), Perl will make it real easy for you. If you don’t know what regular expressions are, dude, you are missing out. Start with the Wikipedia page (as always) and then check out this awesome cheat sheet. I could do an entire post on regular expressions (and I probably should!), so I won’t go into great detail, but basically, regular expressions provide a language for matching, grouping, and manipulating strings (or substrings) that allows you to operate on said strings in a concise and readable way. That’s right, I just said regular expressions and, by association, Perl were readable. Bring it on (in the comments), haters.
  2. String formatting. It’s a simple pleasure, but, boy howdy do I love the fact that I can reference a variable in a string in Perl. No concatenation, just embedded right in there. Love it.
  3. Compile-time failure. Obviously, this is a feature of all compiled languages, but Perl isn’t a compiled language! As a result, you get (some of) the benefits of a compiled language along with the development and iteration speed of an interpreted language. Pretty nifty, huh?
  4. Brevity. One of the reasons Perl is often unreadable is because you can do a lot in a one-liner. This can be incredibly frustrating, but it can also be incredibly awesome, especially if you do something crazy like add a comment.
  5. 37 ways to do anything. Another reason why people complain about the readability of Perl is the lack of consistency. This is because Perl provides eleventy billion ways to do anything. It’s a blessing and a curse, in that consistency is a good thing, and a hammer isn’t the right tool for every situation. So, it’s nice when you can come up with a screwdriver, even if that screwdriver doesn’t fit into your previously established pattern of hammers.

In all fairness, I still like Python better. I find that it has better support for object-oriented programming, a better (read:existing) type system, and is generally more human-parsable. In fact, I started this post with an attempt to come up with 10 things and gave up after 5. That said, as I learn Perl, perhaps I’ll grow to love it more. Perhaps.

2 Responses to “Five things to like about Perl”

  1. May 23, 2012 at 9:46 pm

    I learned perl back in 2000 when everyone was doing it. This was before mod_perl was really famous, when CGI scripts were the thang, and when PHP was being born. I got really, really good at perl. So good, in fact, that I had all but memorized all the functions and idiosyncracies of the language. I could get any job I wanted that involved writing perl code.

    Then the universe moved on. People abandoned perl. Even Java seems simple in comparison.

    I remember the day I decided, “I’m going to learn Python.” That was in 2000. I’ve never turned back since then. I’ve not encountered a language to throw Python down. Not Ruby, not Lua, not C#, not Lisp, not Haskell, not Erlang, nothing… I’ve investigated all of them seriously and they all make me a less productive programmer than i would be with Python.

    I tell you this to tell you about my authority on this subject. I am not some script kiddy that just discovered that there are other languages besides what they tell you about in your high school programming class. I’ve been programming full-time since I was about 8 years old, starting on the Commodore, teaching myself LDA, STA, and all that jazz, and moving up to C and the IBM platform in 1995 or so.

    You are better off not learning Perl. Seriously. Unless you want a job maintaining 10 year old sites, you shouldn’t know it at all. Perl is a horrible, horrible language. Think of how people talk about Cobol. Perl is today’s Cobol. I say this despite the fact I used to go to all the perl conferences and I got a chance to shake Larry Wall’s hand. Compared to C/C++, perl is a wonderful language. Compared to Python and the other modern languages, don’t learn perl!

    • 2 Maitland
      May 24, 2012 at 12:08 am

      I tried to avoid it. Honestly, I got away with not knowing it at all for years, but now, fate has dropped me into a job where Perl is the standard, and I’m not important enough to rock that boat. If I had my druthers, Python would rule the day. Hell, if I were to write a post on all the things I like about Python, I’d probably hit WordPress’s character limit a few times over.

      That said, I’m glad I’ve learned a little Perl. It’s not my weapon of choice (and probably never will be), but I’d rather know what I’m hating. Perl is not a great language, IMHO, (in fact, I totally disagree with you when you say it’s better than C/C++) but that doesn’t mean there’s nothing to be gained by understanding it to some degree.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


My name is Maitland Lederer, and I’m a video game developer. I learn stuff you probably already knew and have opinions you've probably already heard. I figured it might be a good idea for me to start writing down the stuff I've learned so I don't have to relearn it. It's not, like, great wisdom or anything. It's just things I happened to learn, usually today.

Header photo by D Sharon Pruitt, used under a Creative Commons License.

%d bloggers like this: