3 ms·
I think Perl's bad reputation comes mostly from its expressive power. People directly perceive and compare the difficulty of reading and understanding a few co
by pfedor 17y ago
I think Perl's bad reputation comes mostly from its expressive power. People directly perceive and compare the difficulty of reading and understanding a few consecutive lines or blocks of code. Understanding 20 lines of Perl is on average more difficult than understanding 20 lines of, say, Java. The upshot is that you need much more than 20 lines of Java to implement code equivalent to those 20 lines of Perl. But this fact tends to slip your mind when you're pounding your head against the screen trying to figure out how some specific passage works.
- gaius 17y agoI'm not sure that's true. There are plenty of languages as dense as Perl (e.g. how much you can get done with just a screenful of code) but no-one says Haskell (or even Python or Tcl) is "write only" (for example).
- jrockway 17y agoSome Haskell is "write only" :) http://dev.pugscode.org/browser/src http://dev.pugscode.org/browser/src
- makecheck 17y agoYes, I think so. I recently had to explain to someone what "_" means in Perl (not to be confused with $_ or @_). It was simple for me to answer, because I had the experience. But someone seeing it for the first time wouldn't exactly be able to Google it, or look it up in a man page; who would think to look for it under "perldoc -f stat"? What's more, this particular short-cut, while useful, has a side effect: if someone maintaining the code inserts a stat on a different file in between the original stat and the "_", then the source of the "_" changes. For a single character in a script, that's a heck of a lot of barriers for a new programmer.
- gaius 17y agoPerl has demonstrated itself to be an effective tool for experienced sysadmins to write single-purpose or throwaway scripts, but applications spend most of their lives in maintenance. It it always a false economy to make things difficult for maintenance programmers, even unintentionally. Pretty much everyone I work with has been burned by being handed some legacy Perl to maintain and as a result we are very reluctant to do any new work with it. The payoff for rewriting in Python is that the technical debt incurred for using Perl in the first place is repaid.
- chromatic 17y agoI think your first paragraph contains a non sequitur. The existence of the strict and warnings pragmas, Perl::Critic, Perl::Tidy, Test::More, the size of the bundled perldoc, CPAN testers, CPANTS, et al all contribute to the maintainability of Perl 5 applications. If you choose not to take advantage of those tools when writing a Perl 5 application, you bear the risk yourself. How does that reflect on the language or the ecosystem?
- pfedor 17y agoNot to defend this particular programming idiom, but the third result for [perl underscore] is "About Special Underscore Filehandle" http://www.perlmonks.org/index.pl?node_id=613621 http://www.perlmonks.org/index.pl?node_id=613621 so it's rather easy to Google.