Maybe the first time you see it, for at most two minutes once in your entire life.
I kind of wonder if the people who freak out about this syntax stuff have ever studied a foreign language. Do they scream and run out of the room every time they hit an alien grammar construct?
> Maybe the first time you see it, for at most two minutes once in your entire life.
To the contrary, the main problem I've seen and experienced with Perl is that it's very hard to look up syntax. If I had no idea what that code was doing, I would be hard-pressed to Google for "@{$xs->[3]}". I've seen co-workers lose hours to debugging because they think that they find themselves in situations where an X is being evaluated in a Y context, or where they need to dereference a nested something but don't realize that this is what they need to do, etc.
I'm not saying that Perl is unusable because of these things. I'm merely saying that these problems do not exist in other languages, by and large, with the possible exception of C++. They don't run into these sorts of problems when they use Python, which people can just kind of pick up and start using without requiring a deep understanding of the language. (I love "Why I Dislike C++ for Large Projects" for an example of why this is true for C++: http://www.mistybeach.com/articles/WhyIDontLikeCPlusPlusForL... )
I hope I don't come off as a Perl-hater. Although I'm mostly a Pythonista, sometimes there's a Perl module in CPAN to do something that I can't find a library for in Python. This community is probably Perl's greatest strength, which is argued quite eloquently in the OP. Similarly, I often use C++ when I need to write something that runs really fast and/or needs to interface with a low-level library. Both languages can definitely be useful even when other languages are available.
My criticism is simply that Perl (and C++) requires a much deeper understanding of the language to use effectively than most other languages. I have co-workers who have used Perl as a scripting language for years, but who have very little understanding of what references or contexts even are. This often bites them and they lose hours of time trying to figure out why they can't seem to pass a list of hashes to a function, or something. (Similar things often happen with C++.) And this doesn't happen with languages like Python, which make it much easier to write programs without deep knowledge of the language.
It still slows you down if you don't use it all the time. Unless you're someone who has been programming in perl every day for years at a time, then that line is most assuredly not something that takes 2 seconds to learn and you'll remember forever. Seeing something like that while you are reading code means you have to STOP what you were reading, patiently sort it out the syntax and refer to the documentation to be sure you haven't made any mistaken assumptions, and THEN move on. Even if that only takes a couple of minutes, it adds to the frustration level of reading code. And the point is that it is perl-specific. It doesn't happen with most other code that I have to read.
I rarely write "push @$ref" expressions, but they don't slow me when I see them. It is blindingly obvious to me what is happening here. I have never read a manual entry that specifically documents this situation, either... it just makes sense from what I know about push and what I know about references.
(Yes, you need to learn Perl to know Perl. Please let me know what programming language you don't need to learn to use.)
Please let me know what programming language you don't need to learn to use.
I have frequently been able to debug or explain unexpected behavior in programs written in languages I had never used before. Javascript, C#, Python, windows shell scripts, PHP, ASP, Emacs Lisp, and Visual Basic 6.0.
Common Lisp, C, and bash are the only languages I had to really "learn" before I could read code. Perl is the only language I feel like I have to re-learn every single time I have to read it.
It's core to the language; very common usage. Context overloading is very core to the language. I don't know what kind of programming you could do that wouldn't involved references used in this way.
If you want to talk about the rough edges, I can do that. I actually know and use Perl. But when people who clearly have not invested much time with the language try to criticize it's always idiotic. I mean, let's talk about the 'each' operator or the archaic format stuff. The basic syntax of the language is fine; you just don't know it.
As I wrote in another place, the main problem with Perl is the trolls, like Godalus seems to be.
All that garbage has really lessened any interest in Python and Ruby for me. I really don't want to join communities which have so many members doing so large amounts of hype, language wars and trolling.
All that garbage has really lessened any interest in Python and Ruby for me. I really don't want to join communities which have so many members doing so large amounts of hype, language wars and trolling.
So true.
Perl people are not immune to this, though; I have seen a lot of snipes at Haskell and Common Lisp in various Perl forums. People see a threat to their way of life, and do everything possible to maintain the status quo.
(The "complaints" are always about the same sorts of things, too. Perl sucks because it has sigils, Haskell sucks because I don't know what a functor is, and Common Lisp sucks because you can't get into the first element of a list and drive it. These are rarely problems with the languages, and more typically problems with the commenter.)
It is funny, because Perl has been around longer than Python and Ruby, and Common Lisp (in some form) has been around longer than Perl. If the designers of Python and Ruby had done their job, there wouldn't even need to be a debate, we would all be using whichever one was newest.
Maybe the first time you see it, for at most two minutes once in your entire life.
I kind of wonder if the people who freak out about this syntax stuff have ever studied a foreign language. Do they scream and run out of the room every time they hit an alien grammar construct?