I keep turning to Perl. For the man pages. For the stuff in C-PAN. For the one-liner concision that obviates awk, sed, bash and the rest. I've learned much and gone far with many other things, but Perl keeps getting play with me. It continues to be the shortest distance between two things that no one else has ever had to connect. All the classic protocols have serviceable Perl implementations that have been mature since the late 90's. It's a special little programming language and I believe I'm going to continue pulling off little miracles with it when necessary. That's what it was designed to do and it's still fit for purpose as far as I'm concerned.
Perl is designed to be maximally expressive. It is designed to be instantly familiar to someone who writes shell script, uses sed and/or awk and writes C for Unix environments. If you don't have this background, it can be a lot to absorb.
Here are some big things that Perl outsiders find troublesome at first glance:
1. Sigils are mysterious and scary--other languages don't have them. In practice, they're rather nice--they distinguish between functions and variables. They act sort of like a minimalist form of hungarian notation.
2. Built in regexes. Regex syntax is dense and messy. Putting it right in the language makes them easy to use. It also can make things hard to read. Perl didn't invent regexes and tt hasn't stopped most languages from implementing regex libraries. That's why Perl offers the expanded syntax that makes it easy to document complex regexes.
3. Special variables - $_, @_ are odd enough, but when add in the whole panoply from perlvar, it's pretty gross. In reality you really only need to know a few ($_, $@, @_, and $! are the only ones I use regularly), but they are terse and must simply be memorized.
4. Function calls in Perl are weird. Most people use one of the two common forms of argument unpacking that give you pass by copy semantics, but you can also pass by reference. Once you get the hang of it, it's not that complicated, but it is different and can be more than a little confusing for newbies.
5. List flattening. When you call a function like so: foo( @bar, %baz, $qux ), it gets one big list of arguments, the members of @bar and %baz get expanded. It's sort of the opposite of destructuring on assignment.
But the problem is it's one of the worst languages when it comes to readability.
I also used to write perl, especially doing natural language processing, etc. so I know pretty much what you are talking about in this department. But I would always find myself wondering what the hell i wrote 6 months ago when I used perl. That doesn't happen with other new languages I picked up along the way.
So if you're just a lone coder working on your own thing that no one else will use, then no one's stopping you. Go ahead. But if you're trying to maintain a large project with many developers, perl is very inefficient.
I use Python for a lot of the things I used to use Perl for, and one of the biggest benefits is that it constrains your style a lot more, and things look more consistently readable.
Yes, these are precisely the properties that makes Perl unreadable. This permissiveness is a weakness!
To me, it's a combination of two things:
- The culture that it's good to have many ways to do the same thing.
- The abundance of sigils on variables ($, %, @, etc), and how that gets unmanageable once you have complex data structures. Especially once you mix in references.
But like others on the thread said, the inherently extreme flexibility makes it hard to write a consistently readable code. You literally need some sort of discipline to consistently write a readable code.
As a Perl dev earning a living by doing web development in Perl, I am quite interested in the show stopping downsides of the language. I really have my skin in this game.
Not only have I read this thread, I've read the countless Perl bashing articles that keep appearing on the internet and the main complain is the syntax.
Indeed, one can write unreadable Perl but that is also possible with Python, Ruby and even brainfuck (if you can believe that).
I have to tell you this: in my over 10 years of being a paid programmer and over 7 years of being a 100% Perl dev, the syntax is the easiest thing to grasp.