Reply to post: Re: Perl.... Arrggh

Official: Perl the most hated programming language, say devs


Re: Perl.... Arrggh


It is as if the author of the language decided arbitrarily what seems like a good idea.

Almost, but not quite. Larry Wall had formal training as a linguist, so designed the language based upon how humans think rather than the easiest way to write syntax parsers. He also wrote it so that it was very useful for one-liners. There's quite a bit of syntactic sugar, but that's because it makes intent clearer. All of which makes it somewhat different from other languages you encounter. But if you can make the mental leap you may find it rewarding. The syntax is more natural, but it's so different from what you're accustomed to that it's a bit of a leap to realize that it's actually better the way Perl does it.

For example, the "unless" keyword. Sometimes it's a lot clearer to write

unless (condition) {code}


if (!condition) {code}

You'll probably find it perverse that you can place if/unless after code as well as before it, but it can make intent clearer.

If you think about it, English works that way. (emphasis is that you're so stupid you have to think about it).

English works that way, if you think about it (emphasis is that you're bright enough that you probably don't need to be told to think about it).

And, of course, regular expressions are first-class citizens. In other languages they're grudgingly shoe-horned in. Any time I use a regex in another language I end up swearing at the hoops it forces me to jump through. Often they're not very big hoops and it's not much of a jump, but it's irritating.

There's much more I could say, But you probably won't believe that either. :)

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019