views:

930

answers:

7

Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?

Edit: If you downvoted this because you think it's just flamebait, read the answers below. They're not raving arguments; they're well-written discussions of the pros and cons of each language. Give the Stack Overflow community some credit.

+6  A: 

Perl is generally better than python for quick one liners, especially involve text/regular expressions
http://sial.org/howto/perl/one-liner/

Martin Beckett
+18  A: 

There is no advantage to be gained by switching from Perl to Python. There is also no advantage to be gained by switching from Python to Perl. They are both equally capable. Choose your tools based on what you know and the problem you are trying to solve rather than on some sort of notion that one is somehow inherently better than the other.

The only real advantage is if you are switching from a language you don't know to a language you do know, in which case your productivity will likely go up.

Bryan Oakley
You say, "Choose your tools based on what you know and the problem you are trying to solve", but at the moment, I know neither language, and I don't know which aspects of the problem I'm trying to solve are suited by which language. That's basically why I asked the question.
raldi
@raldi - Perl 6 isn't that much different from Perl 5, so you know most of one language. And from what I see, Python's not even THAT different from Perl 5, and much Perl knowledge will carry over into Python.
Chris Lutz
+7  A: 

In my opinion, Python's syntax is much cleaner, simpler, and consistent. You can define nested data structures the same everywhere, whether you plan to pass them to a function (or return them from one) or use them directly. I like Perl a lot, but as soon as I learned enough Python to "get" it, I never turned back.

In my experience, random snippets of Python tend to be more readable than random snippets of Perl. The difference really comes down to the culture around each language, where Perl users often appreciate cleverness while Python users more often prefer clarity. That's not to say you can't have clear Perl or devious Python, but those are much less common.

Both are fine languages and solve many of the same problems. I personally lean toward Python, if for no other reason in that it seems to be gaining momentum while Perl seems to be losing users to Python and Ruby.

Note the abundance of weasel words in the above. Honestly, it's really going to come down to personal preference.

Just Some Guy
Your answer probably belongs to the opposite question; this question provides a link.
ΤΖΩΤΖΙΟΥ
the problem is random snippets of Python sometimes don't work because where they were pasted didn't preserve the whitespace correctly
MkV
+9  A: 

Python does not have Junctions. In fact I think only Perl has Junctions so far. :-)

pi
I, and others, have created "junctions" for Python, just not named it as such, where you can do stuff like: al= [1, 2, 3, 4]; al1= All(al) + 1; if Any(al) > 3: print "some true".
ΤΖΩΤΖΙΟΥ
Junctions in Perl 6 can do much more than that. Can your junctions autothread?
Leon Timmermans
No, not mine. Is junction autothreading already improving the speed of your programs? If yes, by what factor?
ΤΖΩΤΖΙΟΥ
Junctions are not primarily about speed, but about readability.
moritz
+3  A: 

Python has one huge advantage: it's implemented, there's a rather stable compiler for it.

Perl 6 is a rather visionary language, and not yet anywhere nearly stable enough for production. But it has a set of very cool features, among them: junctions, grammars (yes, you can write full parsers with Perl 6 "regexes"), unicode handling at the grapheme level, lazy lists and powerful macros.

In your particular case when you know Perl 5 you'll get familiar with the Perl 6 syntax very quickly.

For a more comprehensive list of what cool features Perl 6 has, see the FAQ.

moritz
Your answer probably belongs to the *opposite* question.
ΤΖΩΤΖΙΟΥ
I'm a perl guy, but you get +1 for giving Perl6 its props as a "visionary language".
Axeman
+1  A: 

You have not said why you want to move away from Perl*. If my crystal ball is functioning today then it is because you do not fully know the language and so it frustrates you.

Stick with Perl and study the language well. If you do then one day you will be a guru and know why your question is irrelevant. Enlightment comes to those to seek it.

  • You called it "Perl5" but there is no such language. :P
Mr. Muskrat
I consider Perl5 to be a language. I'm a Fiver! :D
skiphoppy
Perl 5.10 is out, but you said Perl 5 doesn't exist?
Brad Gilbert
On the contrary, there are a lot of people on PerlMonks and in the Enlightened Perl Organzation's "Perl Iron Man Challenge" who both consider Perl5 to be a language and Perl6 to be a *different* (but related) language. I read the question not as "I want to get away from Perl", but rather as "I believe that Perl5 is about to go away, so where should I go when that happens?", in which case the correct answer is really "Perl5 isn't going away any time soon, so don't worry about it."
Dave Sherohman
I never said that Perl 5 does not exist. I simply do not consider the current incantation of Perl "Perl5". If Larry wanted it called that, he would named it that. :P
Mr. Muskrat
A: 

Python has a major advantage of being available in a production-ready format today.

Python has Jython and IronPython, if you need to work closely with Java or the .net clr.

Perl 6 has the advantages of being based on the same principles as Perl (1-5); If you like Perl, you'll like Perl 6 for the same reasons. (There's more than one way to do it, etc.)

Perl 6 also has an advantage of being only partially implemented: If you want to hack on language internals or help to define the standard libraries, this is a great time to get started in Perl 6.

Sean McMillan