PseudoPrime

  Not so sheer conjecture
Sun, 24 Feb 2008

Do not learn Perl

(with apologies to webmat)

Perl will get under your skin. You will miss its features and quirks when you're not using it. You might even find other languages insufferable, once you get comfortable with Perl.

After you've started using Perl, there's a significant chance you'll start loathing whatever code base you currently have to work on. Especially if it's a statically compiled language. A code base you used to think was ok, except for its few quirks.

After a while of perusing the different Perl-related blogs, you'll have heard other Perlmonks speak of their work with words like beauty, productivity, expressiveness, conciseness, fun and you'll realize just how far your current language is taking you from all of these words.

You'll see

Dictionary someDic = new Dictionary();

And dream of

%someDic = ()

You'll see multiple declarations for the same method, trying to emulate optional parameters and think of Perl's hands-off-my-parameters-thanks attitude, where such a simple method as:

sub method_with_options {
    my ($self, %args) = @_;
    my $encoding = delete $args{encoding} || 'utf-8';
    print "Other options detected: ", join(' ', keys %args), "\n";
    #...
}

Enables all of the following uses

$o->method_with_options(encoding => 'utf-16', other_option => 1);
$o->method_with_options(encoding => 'utf-16');
$o->method_with_options(other_option => 1);
$o->method_with_options

You'll hear about metaprogramming and the complex syntax or frameworks that can bend Java, C# or C++ to allow a programmer to achieve what he seeks.

In the back of your head, you'll think of the insane flexibility allowed by

and oh so many other Perl niceties.

You'll encounter twisted method definitions such as

bool SomeMethod(int param1, ref SomeClass someClass, out SomeEnum resultType, out string result)

and think of Perl's multiple returns that allows you to clearly define what's a return value and what's a parameter:

($success, $resultType, $result) = some_method($param1, $someClass)

You'll delve into huge, puzzling class hierarchies that struggle just to use the right abstraction level for class names\u2026 You'll eventually realize that the whole hierarchy was simply there to share a few methods among loosely similar classes.

Then you'll really get irritated at all the accidental complexity that could have been avoided by simply using mixins, where you define a common method and then include it in any appropriate class. And all of this without ever puzzling over strange abstract names for classes that happen to sit between 2 clear-cut levels of abstraction.

You'll want to explore a new part of the .Net API by playing with it. You'll create a dummy project in some random directory, find a name for it, include the proper parts of the API in the generic main class created by default and finally start playing with the construct of interest.

All this time you'll be thinking of Zoidberg/Psh/PerlConsole, all Perl interactive consoles. They not only allow you to play with an existing API with absolutely no fuss, but thanks to Perl's flexibility, you can even define classes in the console and then play with them!

But then you'll think "Oh yeah, Zoidberg is in fact so flexible that I could use it from a frickin' web page (with a tutorial)!" And you'll realize its so flexible that it would be unwise to do so, unless you *really* trust the chroot jail you to run it from. So you'll fire up a local Zoidberg session and go play there for a couple minutes (when no one's looking), just to keep you sane for a couple more hours. Until the C++ / C# / Java drudgery is over for the day.

You've been warned. If you learn Perl, you'll start thinking it's impossible for you to keep using the technology you're currently using at work. If you're patient you'll try to introduce it there gently (and most likely get frustrated at the time it takes). If you're not so patient, you'll just end up changing job.

While I get to work with Perl full time and its the best job I've ever had, I'm sure a job using a similarly dynamic language could be equally enjoyable.

[] permanent link

Copyright © Andrew Kirkpatrick