DEV Community

Discussion on: Why do people like Perl?

Collapse
 
salva profile image
Salvador Fandiño • Edited

Let my start by telling you all the things I don't like about Perl: Its thread support is rather limited, exceptions are supported but not properly used in the core language, has several features that do not interact well between them or are missdesigned leading to brokenness in corner cases, the DWIM philosophy backfires when you least expect it, and there are probably others I don't quite remember right now.

And yet, Perl is my go-to language in most cases.

Why? because of several reasons:

  1. It suits the way I think. It lets my solve the problem at hand in the way I want without forcing me to do it following some arbitrary paradigm.

  2. It has a rich syntax and that allows one to write concise and idiomatic code. For instance, compare it to Python, in order to manipulate basic objects as arrays, strings, dictionaries, etc. every one of the supporting classes offers you a myriad of methods, every one doing a little different thing, and some of them with several options in order to support all the possible use cases. On the Perl side, you have a rich syntax providing some lower level operations that can be combined to perform the same tasks done by all that Python methods. That approach has both pros (you don't have to memorize a myriad of methods and what they do) and cons (you are using lower level operations, it is not so evident what you are trying to do, the learning curve is harder). As a personal matter, I like Perl way more than the Python one.

  3. It lets you write simpler, easier to understand code (though, that goes in the opposite direction too, it also allows you to write ugly, unnecessarily complex code). Usually, when I write a Perl function, for instance, I would rewrite it several times until I found the way to express what I want to do in the simplest and most clear way. It requires discipline from my side, not letting me just being happy once the code works. In other languages, you have less options, so you end in the middle. There are no so many syntax features you can misuse, but them there are things you can not express in a simple and concise way.

  4. Then, every other language has its own defects. For instance, I can not stand Python scope handling... it is so rather broken!!!, or Java verbosity...

I think Perl has a step learning curve, with several shortcomings you should learn to ignore and/or avoid. But then, once you really learn the language well, and besides all that limitations it is better than the alternatives.

Also, some people find it ugly because of the sigils, the native support for regular expressions, etc. That's very superficial and unimportant. Is like disregarding Lisp because it uses so many parenthesis.

In any case, in my opinion every person has its own ways of thinking and the best language is the one that best fits such ways of thinking. So, it is largely a personal matter.