Saturday, May 31, 2008

Perl is a terrible language

Every time I go to use Perl, I end up having to re-learn it entirely from the ground up. That is how bad the language is. Most languages I can come back and look at some code and say, "Oh, I remember what that does." Not Perl. Perl is the only language I've ever used that I come back to the code and say, "Huh? What in the world did I do there?" And then as I read yet another Perl tutorial (how many do we really need?) to re-learn Perl for the zillionth time (okay, more like 25 times), I say, "Good grief. This language is terrible."

Plus Perl has these weirdly named modules and sticks everything, and I mean everything in the global namespace. Including variables you define inside a function. Perl is the only language I know of where, if you forget to use the word 'my' before using a variable for the first time, it royally messes up the entire script execution and takes hours to diagnose.

Additionally, every last Perl module reeks to high heaven of bad design. An example of a poorly designed Perl module is LWP. Whoever named it that should be soundly beaten. Not that I'm advocating violence. Microsoft would have named it Internet. Or Web. But, no, it has to be an acronym for "libwww-perl". Totally obvious. Plus the module itself is poorly written for the average programmer. What, precisely, does the average programmer want to do with a web module? Well, probably access the web and, almost always, a webpage sitting on a web server. So, someone created LWP::Simple. That is great if all you want to do is run GET requests all day, but if you want to do a simple POST request? Not allowed - you have to go use the full-blown LWP library for that.

Here's a wonderful little function that does a POST request LWP::Simple style:

sub LWP_Simple_Post
my ($URL, $Content) = @_;
my $Request = HTTP::Request->new(POST => $URL);

my $UserAgent = LWP::UserAgent->new();
my $Response = $UserAgent->request($Request);
if ($Response->is_success())
return $Response->content;

return undef;

Now, really, how hard would that be to have quickly thrown together in LWP::Simple? Probably not even five minutes. Perl programmers are clearly lazy. If you write a module for CPAN, please make it versatile enough to not be so incredibly painful to use. Thank you.

I swear that only bad programmers actually use Perl and swear by it. That statement includes you Larry Wall, Mr. high-and-mighty creator of the second worst but popular language on the planet. Only COBOL holds the dishonor of being worse than Perl.

PHP 5 is an infinitely better scripting language. I've settled on PHP for major web development projects and C++ for client-side projects. It is a pain to have to know more than that.

And now a word from our sponsors...

Oh. Wait. I don't have sponsors. Never mind.

I feel dirty after having to learn Perl again. I'll just go wash my brain or something.


  1. Out of frustration with Perl I typed the phrase "Perl is a terrible language" into google and you were the first result.

    Ugh I agree in two years it hasn't gotten better, I mitigate things by trying to use named parameter hashes and going with a more OOP design of modules. The error reporting is cryptic/misleading and I don't even get column numbers just "near blah blah blah ..." which in many cases could mean multiple positions within the line. I haven't used python but I hear its loads better as a general purpose scripting language and PHP most certainly takes the title of the most versatile server side web scripting language.

  2. I got here the the same way as Jim (hi Jim).

    Perl takes all of the fun out of programming. I don't get it at all. You don't spend any of your time fixing the problem you set out to fix, you spend it jousting with the language's idiosyncrasies.

    And the worst thing about perl? There are intelligent people out there that continue to put up with it. It's like a new team entered into F1, go the best drivers and engineers, and then expected him to win with a space hopper.

    Or going to war armed with airguns.

    Or opening up a restaurant, and not allowing your chef any ingredients other than pot noodle.

    Or writing a book containing no words other than "ook" and "PERL IS BOLLOCKS". Actually, that might be quite good.

    Urgh. Back to work :(

  3. Almost 8.5 years after this article, and I got here the same way Jim & Patrick did. Perl is awful, and I would rather cut my eyes out with a dull spoon then continue debugging this Perl script.

    1. Yup. Still a terrible language. Oddly, I'm still focused primarily on PHP and C++ code after all these years. Obviously, both PHP and C++ have withstood the test of time. I also don't jump on whatever the hottest new bandwagon is either (e.g. Go) that has a pretty good chance of shooting itself in the foot. On the other hand, I have only rarely seen a Perl script here or there.