Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Perl Myths (slides from OSCON 2008) (files.wordpress.com)
17 points by soundsop on July 30, 2008 | hide | past | favorite | 18 comments


Being an application developer myself (C++,C#,VB, Java...), I stumbled across Perl when I had to code some text parsing scripts.

From my perspective as an amateur in Perl, I found some similarities with C++ - in my opinion Perl is expressive, powerful and even beautiful. But I also came across one problem (called "Myth" in the presentation), which is that Perl code is not very maintainable.

Of course, code in any language can be made maintainable with proper practices, but I must say that when I looked at my old code 12 months later, I just didn't know what exactly it does. So I consider Perl to not be a best choice for occasional use: I always had to re-learn the syntax and decipher my old code - something I didn't have problem with in other languages.

To sum it up, Perl is a great language, but requires a lot of dedication like C++ does. So the eternal question still remains - Perl, Ruby or Python? ;-)


I don't understand this. There are about 5 to 10 entry level to intermediate level Perl idioms that are just plain useful. (file handles, sed and grep commands, basic regular expressions, etc.) that can do most of what you need to do with typical quick and dirty Perl programs. It doesn't take much to remain fluent with these, though you may need a cheat sheet for keeping @ $ and & straight. (warnings and strict prevent the worst headaches, though.)

My first perl scripts are a complete mess. But my more recent ones are generally one-screen in size more or less... and are a few short (often lispy) subroutines followed by a short imperative program that does something to text stream based on the arguments that were passed in with it.

Decent perl code looks (to me) something half way between Ruby and BASIC. Maybe I'll find out before long, but I just don't see how people can suddenly stop being able to understand their Perl code-- unless they are completely sloppy and cutting all kinds of corners.... :evil:


So I consider Perl to not be a best choice for occasional use: I always had to re-learn the syntax and decipher my old code - something I didn't have problem with in other languages.

To sum it up, Perl is a great language, but requires a lot of dedication like C++ does. So the eternal question still remains - Perl, Ruby or Python? ;-)

Perl is a deep language. No one will argue that's not true. But it is entirely possible to write Perl code in a very Pythonic style, if that's what floats your boat. Perl objects are actually a lot like Python objects. But, if you do that, you're stuck using only the features that Python would give you...which most experienced Perl mongers are unwilling to do. (I'm aware there are a few interesting Python features that Perl lacks, or if not lacks, at least require a slightly more verbose implementation in Perl.)

I learned dynamic language programming with Perl about 10 years ago, and worked in it for a few years. Then I worked in Python predominantly for a while...with some of the best Python developers in the world (if you use Python, you use code daily that a couple of them wrote), and found it a great language. In fact, during those three or four years I decided that Python was a better language than Perl. But, a funny thing happened, I found myself working full-time with Perl again about three years ago...and I decided that I should learn it properly this time rather than banging my way through based on what I could glean from examples of questionable heritage on the web.

It turns out, I was wrong. Perl is a better language (for me) than Python. They're both very fine languages, of course, but there are some things about Perl that really make me happy. Unicode in Perl is so natural it's like magic, for example. Not so in Python, where you have to ask explicitly for Unicode strings--you can actually write Perl code in Unicode, if you're feeling freaky like that. Regexes are first class entities in Perl...a regex can be an object, can be made into a reference, etc. which is incredibly powerful once you're accustomed to it. Backward compatibility is astoundingly good in Perl. We have code that hasn't been touched in 10 years that still runs on Perl 5.10. It may be ugly and old, but it works fine...the cheapest code to maintain is that which requires no maintenance. When I worked in Python, I had to make changes to almost everything between several major revisions: 1.5 to 2.0, in particular, but the 2.x releases also always required minor code changes.

There are a few things I miss from Python, but the "cleanliness" of Python is not among them. Modern Perl is extremely nice to read. What I do miss is a good REPL (though mst's Devel::REPL is coming along nicely, it's still no iPython).

Ruby also seems pretty awesome. I certainly found it very intuitive when I spent a week or so messing with it. But many of the things I really loved came from Perl. I do have to say that it always felt like I wrote fewer bugs into my code when working Ruby than Perl or Python (which always seemed about equal, to me). I dunno why that is, exactly.


> not be a best choice for occasional use

That's a reasonable point, but I struggle to see how other powerful languages differ. Complex syntax and idioms are part of the deal if you want to use a powerful language. There's always BASIC...

I have never had any problem reading perl, whether my own or others'.


The syntax of Smalltalk is simple as is the syntax of Lisp. You can create more powerful constructs and define whatever arbitrary syntax you like with both languages.

Perl and other C/ALGOL-based-languages don't offer this luxury as they force you to use for loops and while loops and other control structures. Lisp gives you a general do loop and recursion and you define your own control structures based on that. Smalltalk is the same way...a loop is merely a message with a block sent to a receiver object.

Perl, C, Python, etc. have rigid syntax and control structures and keywords defined. Common Lisp has only the control structures defined and you can add your own syntax using macros or the syntax read-table. With Smalltalk, the collection objects may have a "while" loop defined, but I can over-ride it if I like.


Actually no. Take lisp for example. It's syntax can be described in a few lines. The functions also are usually quite straight forward and its pretty easy to go back to previous code. Or try python. This language is also pretty easy to work with. The syntax is consistent and the one right way to do thinks philosophy means that reading even other people's code is not a big problem. Contrast this with perl...


Those languages are simple if you use the same basic constructs available in every procedural language. You can write BASIC in any language, including Perl. Otherwise, you have to learn complexity.

Yes, I'm sure description of lisp's loop function would fit in your few lines...


This seems to rely on Larry Wall quotes as evidence.

Edit: I didn't say exclusively... Sheesh...


did you completely fail to notice the graphs and numerical data provided?


No, he is somewhat right. ;-) The "myth" that Perl is hard to maintain was "busted" by quote of Larry followed by mentioning some testing tools. ;-)


And the "myth" that Perl is hard to read was "busted" by showing that someone wrote a book called Perl Best Practices. I don't think that will convince anyone not already convinced :)


Perhaps you didn't read the whole thing or simply enjoy trolling.


I know for a fact that I watched a video of this presentation in the Spring...OSCON must have been a re-run.

Here it is: http://blog.timbunce.org/2008/03/08/perl-myths/


Please don't link stories directly to PDFs; it does odd things with the RSS feed.


{Sh,C}ouldn't the RSS feed be fixed instead?


Potentially, but I'd say it's probably not the highest priority issue in the fixes queue. The site guidelines offer a compromise:

If you submit a link to a video or pdf, please warn us by appending [video] or [pdf] to the title.


PDF's are already detected and marked as such, as can be implied from the automatic appending of [scribd].


That unfortunately seems to not be true as evidenced by the other pdf linked from the front page which isn't marked as such.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: