Stack OverflowPython v. Perl
[+65] [44] Danny
[2008-09-29 18:39:42]
[ python perl programming-languages ]

Okay, so I'm finally making the jump into scripting languages and I have decided to focus on either Python or Perl. The problem is: I don't know which to cut my teeth on.

Most of my programming experience is in C, Java, and C++. There's no specific task I would be learning Python/Perl for, other that possibly applying it to my dev work to make life easier in general.

What do you think? Which do you use? Is one more industry relevant than another?

can i ask why python/perl over say ruby or javascript? - ethyreal
Which industry? Languages often have some killer library that makes it the industry choice in a particular sector. Find out what sort of work you want to do and what they use. :) - brian d foy
[+168] [2008-09-29 20:07:22] Dave Rolsky

There's an awful lot of FUD here about Perl. One thing I've noticed is that Python folks seem to have a bit of a thing for bashing Perl, but you won't see that so much in reverse. The insistence that you can't write maintainable Perl is pure bullshit. Maintainable code comes from good developers following good development practices, and that can be done (or not done) in any language.

As a Perl guy myself, I have nothing against Python. It seems like a pretty good language with a strong community.

Both Perl and Python are fairly mature and featureful languages. I think Perl's CPAN beats Python's libraries by a fair bit, but OTOH Python has way more standard libraries, so you don't need to go looking for 3rd party libraries as often. Also, CPAN's expansiveness is a downside, as there's often many overlapping libraries for a given task, making finding the best one harder.

I'm surprised you didn't mention Ruby. I think it's another worthy language. It's less mature than either Python or Perl, and definitely slower, but it's got a lot of pluses too, including being "truly OO" in a way that Python isn't (and Perl isn't even trying for).

FWIW, if you're interested in Perl I'd strongly recommend checking out some of Perl's highlights on CPAN, including Moose [1], DBIx::Class [2], DateTime [3], etc. Of course, Python and Ruby also have particularly excellent packages that people will point to, like Rails, Twisted, Django, etc.

Disclaimer: I'm a Moose core dev and the creator of DateTime. But they do rock, and I know lots of people in the Perl community agree.

This actually gets to a secondary point. A language is much, much more than its syntax. In fact, syntax is the least of what makes a language. It's an ecosystem, and to truly appreciate a language you also have to take some time to learn about that ecosystem. Perl has a really amazing ecosystem and community. I bet Python does too.

To a large degree, you need to find the tool that fits your brain best. Perl and Python can do basically the same things, but they do them differently. Try both out (and try Ruby) and see which one works for you.


Actually Perl6 is trying to be very OO, everything can be treated like an object - Brad Gilbert
(2) Perl 6 is trying to be very OO, but, and this is key, without forcing you to learn or use OO. - Tanktalus
(1) My answer was solely about Perl 5. Perl 6 looks great, and I'm looking forward to it, but it's gonna be a while longer before it's ready for any "real" use. - Dave Rolsky
(8) I agree that maintainable code is a reflection of the developer, but any given language does make it easy, or difficult, to do so. IMHO, Python supports readability more than most languages. - Michael Easter
(1) Props for DateTime! I used to love that module back in my Perl web days. There's nothing quite exactly like it for Python... (And Moose looks brilliant too... but the fact that there are multiple cool ways to create an object is part of why I now use Python ;-) - Dan
(16) I think Python's "there's one way to do it" probably does help readability. But you can write readable Perl code, and it's not all that hard. I bet you can also write unreadable Python, and given how many crap-tastic developers I've seen, I bet it happens all the time. - Dave Rolsky
(11) Dan, Moose is much better than Python's OO. Much, much, much better. Yes, one way to do it makes things easy, but OTOH you might not have Moose without Perl's wacky flexibility. - Dave Rolsky
(1) If there's nothing like DateTime for Python, then I will never waste any time with Python. How can a language call itself modern and not have a decent date object? Even dBase IV had that. I have some gripes with DateTime, but I love it and use it daily. - skiphoppy
(8) "datetime" is a module that is part of Python's standard library, and I know it has been in there since at least 2.4. Is there any functional differences I am missing? I have used Python's datetime module and I am quite pleased with it. - Lara Dougan
(1) Skiphappy and Doktaru, Python does indeed have a datetime module which is quite similar to Perl's, but without as many of the conveniences that make manipulating the objects so easy. Still, it's perfectly feature-complete... just slightly more effort required. - Dan
(1) @Dave Rolsky: how does Moose interact with legacy objects? I couldn't find anything about that in the docs. It certainly looks impressive, but I think for many purposes a consistent, long-lasting OO methodology is more valuable than a brilliant, innovative one. - Dan
(5) @Dan: Moose "just works" with legacy objects, as long as they're hashrefs. If they're not, check out MooseX::InsideOut, with which you can subclass any type of reference. - Dave Rolsky
(3) Also, for anyone curious, asking on is a great way to get a quick answer. - Dave Rolsky
(3) @doktaru, the perl DateTime module is years ahead of python datetime in terms of natural-language parsing; I'm a huge fan in that respect (though otherwise a Python guy; I haven't used Perl for almost a decade and hate hate hate its syntax). - Charles Duffy
[+79] [2008-09-29 18:50:45] Dan

I have used both languages professionally and for fun.

I learned Perl around 2000-ish, and was a big fan for many years. I had never used a dynamic language before and was really impressed with how much more effectively and quickly I could write working code, compared to C.

Around 2002-3, I started to hear about Python a lot and glanced at it... the whole "significant whitespace" and strict type checking thing turned me off and I purposely ignored it for several more years. Eventually I found my Perl code was getting really unmaintainable, and seriously took up Python. I've never looked back. Python is basically dynamic language done right. One of the best things about it is that the standard library is extremely versatile (database, XML, JSON, math, etc.) and all those modules have a common interface and feel, which makes them easier to learn and use.

Eventually, Perl just got to be too much of a mess, I'm afraid. It's not really Perl's fault. They kind of made Perl up as it went along. No one knew what a dynamic language "should" look like or do when Perl was first released (pre-1990, I think). So it's got a lot of things oddly bolted-on, like variable scoping, file handles, and a very messy object-oriented system.

Perl 6 is supposed to be a lot cleaner but no less expressive. But it's taking yeaaaars for it to be ready. Why wait? Python's ready now and the much-anticipated 3.0 release is in beta.

PS- Perl's CPAN is indeed a very nice feature. Python has the Python Package Index (aka Cheese Shop [1]) which is more or less the same thing. All ya gotta do is "easy_install packagename" to download, build, and install from it.


Perl was initially released in the early to mid eighties. - Brad Gilbert
(2) For the record, Perl and Python are about the same age. Python didn't have a leg up on "what dynamic languages should look like". They just have entirely different backgrounds and entirely different purposes. - Thomas Wouters
(2) That sounds exactly like my Perl/Python learning timeline. I used Perl for years (since 1997ish) and wrote a lot of code with it, and actively avoided Python because of the whitespace thing. I got over it though, and now use Python. I wrote some Perl code the other day and cringed the whole time. - Greg Hewgill
Brad and Thomas, thanks for the corrections. I hadn't realized they were of a similar age. I guess it would be more fair to say that Perl built a lot of users and a big codebase without the language ever really being "designed", whereas Python had a clear vision from the start. Maybe? - Dan
"Early to mid 80s" for some value of "early to mid"... Perl 1.0 was released to comp.sources.misc on December 18, 1987. - Dave Sherohman
(1) According to wikipedia, Perl was created in 1987 and hit 1.0 the same year, while Python was created in 1991 and hit 1.0 three years later. So that's a fairly big difference in both the date they were invented, AND how long the development process was before the languages "solidified" a bit. - Dan
(16) FWIW, I find that scoping for lexicals is one of the things that Perl got absolutely right in every detail. Block scope is variously broken in Ruby and Javascript, which is annoying enough, but the necessity of the hack for mutating closed-over variables in lambdas in Python is utterly indefensible. - Aristotle Pagaltzis
(3) I find this use of "dynamic" to be confusing and vague. In my experience "dynamic" in relation to programming languages refers to it's typing constraints. Under those terms Python, Lisp/Scheme, Objective C are all dynamically typed. Specifically Python is a "late binding dynamically typed language." Perl is weakly typed, but not dynamic. Variables are scalars, lists, hashes, file handles, etc. (The fact that a scalar can be used in string or integer handling functions and expressions doesn't make them an example of "dynamic" typing, for example). - Jim Dennis
[+74] [2008-09-29 19:21:41] jkramer

There are so many people praising Python here that I think I have to put a bit of counterweight here. :)

Maybe I'm a bit biased because I've been coding in Perl for so long, but I think this also allows me to give a better insight into the language. Many people are frightened of Perl because they saw a cryptic one-liner and think to know that Python is "cleaner". Here's what I think.

As some people already mentioned, Python is a very verbose language. It forces you to indent correctly. This doesn't mean that you can't indent Perl code nicely too, it just means that Perl still works if you don't. Pythons verbosity also makes single pieces of code more understandable. However, if you look at bigger Python applications, you'll find that being force to write simple things with much code distracts from the real important things. If you know Perl well, you'll thank God for the possibility to put simple things away in two lines or three or even a one-liner and put the spotlight on the important things, like business logic, which you're free to write as verbose as you feel like. If you know a natural language, one line of text is more understandable than 20 lines, saying the same thing, isn't it?

Perl is surely harder to learn than Python. And it takes longer to learn. After years of using it every day I still find cool features sometimes that I didn't know before, and that I absolutely love. It's a bit like Vim. ;)

Some people also claim that the Python community is more active and develop more cool new things. That's surely true. Perl people don't develop cool new things, because they've been developed years ago and are available from CPAN, ready to use.

To make things short: Python forces you to do things. Perl allows you to do things your way. You will do lots of errors in the beginning, because Perl doesn't say "do it this way, or it won't work!". While Python will make it easy for you in the beginning, Perl will allow you to be effective in the end. Plus (and this is why I love Perl so much), when you become better, you'll learn to love the freedom to express yourself with your code. Code is just art, after all.

(2) Very insightful. I agree that the flexibility of Perl is powerful... but often not in a good way me, since I end up using some obscure delightful feature once, and then I'm unable to decipher it. It is a ton of fun though, but the maintainability/scaling issues really bit me. - Dan
(4) People keep calling Perl a "write-only" language, but in my oppinion that's just plain wrong. If you don't understand a feature, don't use it. I've never had problems reading code I once wrote. It's a completely difference thing with other peoples code though. ;) - jkramer
Dan, people who don't use Perl all day long, every day, shouldn't use cool whiz-bang features they learned about five minutes ago. :) Until recently, I did use Perl this often, and I still avoided some of those features. - skiphoppy
Python may be more verbose, but I find that I am personally much more productive with it, and I love using ipython for debugging code. Use what you are most productive with, but always try something else from time to time. - Lara Dougan
(2) "People keep calling Perl a 'write-only' language" I've heard that since 1997, still isn't true, maybe some day. - jettero
(3) Dan - meaning no offense, but that is why comments were invented ;) When I use some overly crafty piece of Perl-ese, I always comment on it. - DVK
(2) Python is actually not significantly more verbose than Perl in production use. For one thing Python requires less punctuation, and the extremely extensive Python standard libraries tend to allow one to accomplish quite a bit with very little code. Dynamic typing and pervasive support for iterators, and other features can save quite a bit of code for marshaling data from one type to another and obviate many control local variables, for example. Most working Python code is only a bit more verbose than pseudo-code. - Jim Dennis
(1) you are wrong re python being very verbose language. check CodeGolf tag here and see how compact python can be. Btw, as Bruce Eckel said (quoting from memory), Python is executable pseudocode. Perl is executable line noise - Nas Banov
[+55] [2008-09-29 20:21:34] Will Harding
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

I'm a python guy personally. But I still need to give tons of credit to Perl. It runs just as much of the internet as apache and 2/3 of every data center. The CPAN has 12 different ways to do anything. And Perl people are just plain nice.

The people that say Perl is hard to read are being silly. The Perl they tried to read may have been hard, but I've paged through tons of Perl that was more readable than the python I write.

I think pythons major advantages are its interactive interpreter and docstrings (which can be easily printed from inside the interpreter), but for quick hacks on files, perl.perl.perl.

(8) Perl has a nice REPL these days, Devel::REPL (on CPAN, of course). - Dave Rolsky
Perl can run interactively too. - Rob K
(2) I'm a Perl guy and I wish I had the ability to mod this post up more than once. Thanks for the kind words :) - hexten
(2) that could have been guido van rossum himself :-) - Gnark
(2) Dave, PDL also has an interactive shell for Perl. CPAN is fun. - Joel
[+45] [2009-09-03 21:24:51] ldigas

What are you gonna put your trust in?

alt text

(Disclaimer: I have nothing against neither. Just seemed a catchy line.)

[+25] [2008-09-29 23:35:18] Axeman

I've tried Perl, Python, and Ruby. (I've taken a look at Neko [1], and groovy and beanshell, too.)

I started out in Perl. I learned enough to start using the "black magic" of source filters, symbol table manipulations, B and AUTOLOAD. Then I began to hear some complaints and comparisons from the Python crowd.

Then I noticed some of the same dissatisfactions I had with Perl echoed in Python enthusiasts. This turned into frustration with the idea that there really are too many ways to do it in Perl.

Python is touted as more aesthetic, but that's only true if you don't find yourself deep-diving and using the __<foo>__ methods and variables too often. There is no definite gain in aesthetics using num.__rmul__( otherNum ).

Python turned out to be no where near as "intuitive" as billed. And although, Python remains a acceptable language, I think the hype ended up influencing my decision to move on.

I met ex-Python rubyists bagging on Python much the same way that Python enthusiasts bag on Perl. So it only seemed justified in subjecting Python to the scrutiny upon it that they, as a body it seems, subject Perl to.

Ruby is more aesthetic in almost all syntax, and I found it to be a little more "intuitive". (Sigils have never bothered me.) But as mentioned above, Ruby is still rather slow outside of JRuby. I also don't like the sometimes arbitrary non-OO syntax in modules. Instead of using the behind-the-scenes names for the overloaded operators, you defined the operator itself.

Perl 6 will have something that Python and Ruby do not yet have, and that is the ability to invent operators. I have already played with this in pugs, and it's one of the things that can be afforded with having a language that understands grammars.

But the harshest criticism that can be leveled at Perl 6 is that it is practically "vaporware". Outside of that, though, enhancements for Perl 5 look to what has been codified for Perl 6 to include.

And the flexibility of Perl seems to suggest itself again. Perl Best Practices [2] takes place of rigid rules about the best way to code. And where as Perl presented a daunting variety of OO paradigms, Moose [3] is informally becoming the way to do OO.


Gemstone's Smalltalk implementation of Ruby, called maglev, is pretty fast :) - brian d foy
(2) For further reading about perl6, check out , the new home for perl6 development. They've come a long, long way in the last few months. With monthly release cycles, it's really easy to see the progress of the implementation, and boy does it look good! - Robert P
(1) @Robert P: I would have to agree that it is probably unfair to call Perl 6 "vaporware" these days, but I still think "practically 'vaporware'" somewhat valid as a summary statement in that in 90% of the time its been out there, it's still too little for the end user. - Axeman
[+24] [2008-09-29 23:22:39] Dave Sherohman

Now that I'm done reading all the comments about how Perl is unmaintainable, write-only, and doesn't do OO, I suppose I could argue against them, but I've spent enough time screwing around on stackoverflow already. I really should get back to updating the Employee class to add new features that have been requested on the Perl web app I wrote last year and haven't looked at since. There's a little bit of a ramp-up time on getting back into a project that old, of course, since I no longer remember what I did back then, but it's perfectly clear once I look at the code.

If you already have good programming habits (as I did from many years of other languages before getting into Perl), there is nothing to fear from Perl.

(5) "nothing to fear from Perl" -- except maintaining other peoples' code. - Charles Duffy
(17) ...which applies to every language. You can write perfectly clear Perl and utterly unmaintainable Python. It has far more to do with the person who wrote the code than the language it was written in. - Dave Sherohman
(1) The "hard to read" reputation of Perl came from the extensive use of punctuation characters: regexps and sigils. Perl was the first language that had regexps as a built-it. However all others programming languages have since copied that powerful feature and now every programmer has to know how to read regexps. - dolmen
[+21] [2009-02-11 18:33:00] Jeff

My two cents: I used to do a lot of coding in Perl, and now I do a lot of coding in Python. I am happy with this change. Personally, I find Python syntax much easier to read, and the core concepts easier to grasp. After years of Perl coding I still couldn't imagine getting much done without reaching for the camel book, and with Python the concepts seem to stick, although maybe that's just me. Here are some specifics on why I prefer Python:

  • Python scales up more easily than Perl. That is, if your project is going to grow beyond much more than a single script, Python makes that kind of organization a lot easier. As others have pointed out, good design is entirely possible with Perl, but in Python it's easier.
  • Python has better high-level data structures than Perl. I'm sorry, it just does. Perl has hashes and lists just like Python does, but combining them in Python is so much simpler than in Perl that it's not even funny. Perl's references are a cruel joke by comparison. As a programmer in a high-level language, these data structures are my bread and butter. This difference alone is enough to make me prefer Python over Perl.
  • Syntax matters. Readability matters. If you program in Perl long enough, you won't even need to look up things like $" and $/ and $* and @F and $^O and on and on and on. But you know what's even better than knowing them by heart? Never having to learn them. This is a trite criticism of Perl, I know, but it's still true. Whale guts, line noise, whatever you want to call it -- Perl has it, Python doesn't.
  • If you care about OO, then Python wins. This goes along with what I was saying earlier about Python scaling up more easily than Perl.
  • Python has Jython and IronPython, which are really nice if you use Java or .NET. I think Perl has some Java and/or .NET implementations, but I don't know if they are well supported. I kind of doubt it. Jython itself has only recently awoken from hibernation.
  • Perl's contexts are bizarre, confusing, and unnecessary. This is just a poor design decision, in my opinion.

I must admit that Perl has a few advantages, too. Here are some of them:

  • Perl's regex syntax is really nice. It's the best I know of.
  • Some have mentioned that Perl has a faster interpreter. I'll take their word for it. This has not been an issue in my projects, but it may be one in yours.
  • If you want to pump your shell scripts up on steroids, Perl may be a more direct translation than Python.
  • Python has a better standard library, but Perl has a better nonstandard library. CPAN is pretty awesome, whereas Python's package management is... um, lacking by comparison. I've seen others say the opposite, so maybe it's just me, but my experience has definitely been smoother with Perl in this area.

If Perl 6 weren't vaporware, then that would be something else to consider in favor of (a future version of) Perl. But the onus is on Perl at this point to show us that this is not true.

(2) "If you care about OO, then Python wins." I've gotta disagree pretty strongly with this. If you care about OO, then Perl + Moose wins with a big KO. - Christopher Cashell
(1) Perl regex syntax is so nice that Pythons regex uses similar syntax ;) - Wayne Werner
[+19] [2008-09-29 19:04:38] Cody Hatch

Perl is a fairly poor language to learn. Don't get me wrong - I like the language, and use it quite a bit. But for learning... Oh dear, where to start?

  • There's always more than one way to do something. Usually dozens. And many of them - quite frankly - are very bad ways to do it. As a new user not only is this complexity confusing, but you probably won't be able to figure out the hidden pitfalls until too late.
  • Perl has a confusing, cryptic, and very dense syntax. In the hands of an expert this allows for extremely powerful scripts to be written that fit into a line or two with a minimum of typing. For a novice, however, you may spend hours puzzling over some overly-clever trick in an example.
  • Perl doesn't enforce good habits. That's part of the attraction - you can do anything. This includes writing clear documented code adhering to good programming practices. It also includes writing absolutely unmaintainable "write-once read-never" code.

Python is just as powerful, but the syntax is much cleaner, and - I realize this is absolutely subjective - it's a bit harder to abuse. For example, the whitespace rules mean that you HAVE to indent and structure your code at least slightly sensibly, which is - frankly - a pretty good thing to enforce, especially when learning. Learning good habits early pays off. :-)

In short, while Perl is a great language, for learning, I'd recommend Python. (Ruby would also be a decent choice.)

(5) I agree. If you just "love programming languages", you'll love Perl. It has sooo many neat quirks and tricks. But if you want to write something that actually works and is elegant and maintainable... Python. - Dan
(3) Well, it's true and not, you can write lousy and unmaintainable code in any language. While perl makes that more easy, you also need to think in python, it does not come for free... - André
(1) Perl is a great language for learning, if you think in terms of learning over a lifetime. - Bruce Alderman
(2) "Where to start learning Perl?" How about starting with book? ;) - potyl
(1) Ruby is the sibling of Perl. They are alike. - jpartogi
(2) "Perl doesn't enforce good habits." Sure it does. All you have to do is ask it to. Enable use warnings, use strict, and add in Perl::Critic, and you've got a framework that will enforce good habits better than Python or Ruby. - Christopher Cashell
[+19] [2009-02-09 18:43:46] JDrago

Learn Perl.

They say the richness of a language is in its abstracts. Perl has plenty. Expressiveness is a good thing.

The techniques I learned almost 10 years ago are just now finding their way into other languages that purport to be so much more modern. A language that clobbers you over the head with the "YOU WILL DO EVERYTHING IN OO" or "YOU WILL INDENT 4 SPACES" two-by-fours are asking to be replaced by the next big paradigm.

Perl is post-modern, and will always be up-to-date, because it does things your way, rather than forcing you to do things its way. As your way changes, Perl will change with you. Perl6 only adds to this strength, making Perl6 more Perl than Perl5 is now.

(3) You can do "YOU WILL INDENT 4 SPACES" in Perl also, by using perltidy. And it will be done automatically. - Alexandr Ciornii
(4) Python doesn't require you to do everything in OO. It just makes it easy to do. Most Python modules are some combination of functions and classes. - Jeff
(1) @Jeff - I generally need a language to do what I want it to do, rather than doing what the language wants ME to do. - JDrago
[+17] [2008-09-29 18:46:56] Tanktalus

I use perl and never learned python. But I come from a background of shell scripting with awk/grep, and C/C++. That made perl just far too easy to pick up, as it has nearly all the power of all that came before, and ties it together really simply.

So, it's really hard to answer without a lot more context: do you have any perl/python tooling/programmers available to you at work? [1], for example, is great as a language-specific site, though it's still better to have someone to talk with right in front of you instead of waiting for responses.

What do you want to accomplish?
I know you said you don't have a specific task, but I have always found it easier to pick up new skills by having a target in mind. I had little mini-projects that helped me learn C, C++, STL, Perl, and just recently SQL. They make it fun to learn, and anything fun is easier.

So find a project that makes sense for what you're learning, and try it. The questions you come up with from there will propel you into whichever language you're learning.


[+15] [2008-09-29 19:42:48] zby

On the technical level I would weight those two languages as more or less equal. But my bet is still with Perl - because of CPAN. It is experiment on the joint between technical, social and political and I think it have got a lot of balance right - and as show all the other attempts this is not an easy thing.

[+14] [2008-10-04 01:01:42] Robert Rossney

I've been developing software professionally for about 30 years. Python's far and away my favorite language.

It was remarkably easy to learn (it took me about 2 hours from installing it on my laptop to having a working program that did Markov-chain-based gibberish generation, which is usually the first thing I try when I pick up a programming language). The elegance (and thoroughness) with which fundamental data structures like sequences and dictionaries are integrated into the language is not only intellectually appealing, it also gives the language a kind of self-similarity that makes understanding it come quickly.

I wanted to like Perl. Really I did. I put a great deal of effort into it, because at the time (about 5 years ago), I desperately needed a decent language for writing utility programs. But I just never got it. I never got over the sense that what I was trying to use was a grab-bag of mostly-unrelated good ideas that had been bolted together over many years into a sort of lumpy, awkward whole. I put at least as much time and effort into learning and using Perl as I have into learning and using Python, and I never got to the point where I felt really grounded in the language.

There's certainly stuff that's not pretty in Python. (I mean, name mangling? Really, Guido? Really?) But if Perl has the kind of self-similarity and internal consistency that makes Python so easy to learn, it's well-hidden.

(2) Great way to put it, Robert. Python is easy to learn and use. You rarely notice its limits. Mostly you figure out the basic feel of it and then just keep saying what you mean, and it does it. - Dan
[+7] [2008-09-29 18:42:12] JeeBee

I really like Perl, after using it for a few years. It's really powerful, especially for text processing. It has a really strong set of libraries available through CPAN. It is a little quirky however, and Perl 6 is going to change things a lot. Perl 5 however is very solid and proven.

Python, however, I don't have a lot of experience in, but I suspect that it is the better language to learn today as it gains popularity.

[+6] [2008-09-29 20:59:44] Bruce Alderman

I've used Perl for several years, and have looked at Python a little but never really learned it. I'll offer a few random thoughts about Perl:

  • As others have said, Perl is a quirky language; personally, that's one of the things I like about it.
  • Because there's more than one way to do it, Perl is harder to learn than some languages. However, since you have a background in C, you shouldn't have trouble learning a way to do what you need.
  • Structurally, Perl is more C-like than Python is, from what I've seen. From syntax to curly braces to use of whitespace, Perl will probably feel more comfortable to a C/Java programmer.
  • Perl is not an object-oriented language. You can use Perl modules to do OO-like stuff, but Perl's object model is nowhere nearly as comprehensive as Java's.
  • Perl is so flexible that it's easy to get started with a subset of the language, and learn additional functionality later.

That last point is the most important, IMO. I spent nearly a year writing small scripts before I even knew what a hash was; after learning about hashes, I had a better way to handle data. It was more than a year before I tried regular expressions; after I learned them, I had a better way to process strings. I didn't understand how to use modules as objects until several years later; but when I did, I had a better way to organize my data. I've programmed with Perl off and on for over six years, and there are still features I haven't even looked at. As I learn them, my productivity will probably improve, but I am still able to get things done at my current level.

"There is more than one way to do it" allows programmers to advance at their own pace and comfort level. You might have a completely different way of solving problems than I do, and that might make your Perl code look cryptic to me, and vice versa. (That's probably the main reason Perl is so often criticized as being unreadable.) But Perl's flexibility puts the programmer in charge of how things get done.

(4) "Perl is not an object-oriented language." - Considering Moose, I would put Perl on par with any other language for OO facilities now. In fact, Moose puts it ahead of many (most?). - Christopher Cashell
[+5] [2008-10-03 10:46:18] community_owned

I've tried very hard to stay objective about this in the past year or so.

For the kinds of things I'm interested in, there are only 3 serious language choices: Perl, Python, Ruby. I need something that's fast and flexible, and has a large user-supported library of software. I discard Ruby as most people already have Perl or Python installed and I'd rather not add another dependency.

Perl is less verbose. You can cram a lot of logic into a small number of characters. This is both a blessing and a curse. I find some of Perl's shortcuts to be extremely useful... especially the easy shorthands for running a regular expression on a file, or operations like checking if a file exists. The result of this is that you can, if you choose, end up with very concise scripts. One downside is that there are less clues as to what is going on in a script for those who don't know the shortcuts.

Python is more typing. I don't consider this a negative. I'm convinced that syntactically significant whitespace is a red herring and shouldn't be a serious mark for or against the language. I've thought it was significant in the past, but I was wrong. Don't judge either language on its syntax except as a means to determine which you find more aesthetically pleasing. I find Python more aesthetically pleasing at the moment. In 4 months I could change my mind.

If you're doing anything relatively object oriented, I'd recommend Python. I haven't looked at Perl's implementation in a while, but I remember it being messy and overly complex. I'm not convinced that Python's implementation is all that great, but it's ridiculously simple.

Aside from that the languages are about equal in every sense that matters. Use the one you like better. Neither language is as good as their respective pundits claim, but they can both be very useful tools in the right context.

One minor concern: using Python with other developers may force you to get your collective heads out of your asses and agree on a standard whitespace format. If you don't have one, you need one. It's important, and not just for Python... for the general sanity of all your programmers.

(4) "If you're doing anything relatively object oriented, I'd recommend Python." - Check out Perl's Moose. It puts Perl on par with, or ahead of, pretty much any other language with regards to OO. - Christopher Cashell
(1) On Whitespace: just follow PEP 8. That's what BDFL's are for ;) - Wayne Werner
[+5] [2008-09-29 18:43:18] Ben

I agree that Python is the langauge of today and might be better but I would also consider the environment you work in.

In my case Perl is common on all our servers and it's not always easy to get Python installed. Also, most people in my organization know perl and not python so if someone needs to give me a hand or maintain a program when I'm on vacation again Perl will be the better choice.

[+5] [2008-09-29 18:58:54] Avdi

Compromise: learn Ruby. Ruby has a strong Perl heritage, with much of Perl's syntax and conveniences. While it is not as inspired by Python, it shares with Python a strong emphasis on Object-Oriented style.

Ruby 1.9 is moving away from their strong perl heritage as I understand it. - Axeman
So Ruby also have Perl cryptics? - jpartogi
(2) The worst of both worlds? ;) - Wayne Werner
[+3] [2008-09-29 18:58:51] Pete Karl II

Reach for Perl under these conditions:

  • Memory use is critical
  • Low IO overhead is required (i.e. – many, many text files are being parsed)

Reach for Python under these conditions:

  • You need something that processes quickly (but isn’t memory intensive)
    • On the average, Python and Perl are neck & neck here. If you have more experience w/Perl, go for Perl. If you need something readable, go for Python.
  • You have an OOP OCD
  • You don’t know Perl, and you have some hefty processing to do (that isn’t memory intensive)
  • You’re making the step from static HTML to dynamic web pages cough, and you have a CS degree

Do you have a source for the IO overhead comparison? I haven't seen that before. In general, if you need heavy-duty, mind-numbing repetition, use a C extension and do the interesting parts in Perl/Python. Writing C extensions for Python is very easy, Perl a bit more annoying. - Dan
[+3] [2008-09-29 18:43:26] torial

For humor, I refer you to:

Both languages are used in a large number of scenarios. Perl is quite popular as a config and control language in IT departments. However, Python is used by many companies for prototyping larger applications, and optimizing their apps w/ C/C++ later. Google is an example of such a company.

Personally, i find Python intuitive, and while I code in .Net, my love and my easiest learning is w/ python. If you need something to cut out the syntactic cruft so you can think about problems, go with python.

[+3] [2008-09-29 18:40:51] FlySwat

I don't use either, but in my dabbling with both, I've found Python to be a language that makes a lot more sense to me.

Perl is a good language, but Python is definitely the fad language of today.

[+3] [2008-10-02 20:11:07] Alexandr Ciornii

If you want same readability in Perl as in Python, use perltidy from CPAN - you will get it automatically instead of doing it manually in Python.

If you want to get a job read this comparison: Perl, Php, Python and Ruby: Whats More Popular in the Corporate World [1]


may be the research is missing the point, almost all jobs in system administration will require some knowledge of perl to handle scripts, but probably in them will be little programming. Ask instead how many jobs in Software Development are there in each language and the number will change for sure. - Sam
@sam - Its not clear but that "research" may have just been for developers? This separate research shows similiar figures/trends and is broken by "software engineer", "developer" & "programmer"....… - draegtun
[+3] [2010-02-12 14:50:04] Val

I know many programming languages. I love Perl. It is powerful and is doing the job well. But I would NOT recommend Perl as a starting programming language for a beginner. Perl tendency to be forgiven plus the freedom it gives you might be more of a problem that a feature to newcomers. In plain words, as a beginner you will have a bigger chance of developing bad programming habits in Perl than probably in Python. On the other hand, once you have good programming habits and you manage to develop your own programming style, you might find Python syntax almost impossible. You know how and when to indent, you don't need a language to tell you that. This is the main reason for why I could never move more deeply into Python. So if you are a good programmer with a solid programming discipline I would recommend Perl.

[+2] [2008-10-02 20:25:35] David Thornley

As a Perl fan, here's a few points:

If you know C and Unix, Perl will probably be a bit easier to get started with.

Perl has really good library support.

Perl's great for short scripts. I never write anything in bash any more.

You can get both Perl and Python on any platform you're likely to be computing on, but Perl is perhaps a touch more likely to already be there. (The downside to this is that the system Perl is more likely to change versions out from under you - happened on AIX once, and a badly written Perl program simply stopped running.) However, Python is more easily rewritten to sit on different platforms. I don't know of Perl analogs to Jython and IronPython (JVM and Microsoft's CLR respectively).

There is Perl on .NET - Alexandr Ciornii
Thanks - I don't use .NET, and wasn't following it. - David Thornley
[+2] [2008-09-30 03:11:04] Michael Easter

I recommend Python: it may be my favourite language. It supports both OO and functional programming: you can do mind-blowing things in comparison to Java. Also, it is quite readable, has a rich library set, and has a sense of aesthetic in the community (called Pythonic).

As for use in industry, it is used by some major players: e.g. it is one of the few languages approved for use at Google. That said, Perl is probably used by more companies, as it was huge for years.

You didn't ask, but I would suggest Ruby and Groovy as other candidates. Ruby versus Python is a true dilemma ( I've blogged [1] that this is like choosing between a Porsche and a Ferrari). Groovy's advantage is that the syntax is similar to Java and you can use the familiar Java libraries; however, if you want something truly new, that might be a drawback.


You might aswell use Scala rather than Groovy. - jpartogi
Scala versus Groovy is an interesting debate, but I wouldn't suggest Scala in a "Python or Perl" discussion. - Michael Easter
[+2] [2009-08-27 11:48:53] Andz

There's no specific task I would be learning Python/Perl for, other that possibly applying it to my dev work to make life easier in general.

Oh, ABSOLUTELY choose Python over Perl. Perl was the first scripting language I picked up back in the days when PHP was barely invented and while I loved the way it made certain thing so much easier than in C/C++, it also possessed so much obtuse syntax that tripped me up endlessly. When PHP came about, I ditched Perl without a second thought. After PHP, I learned Python and loved it so much that I try to use it in lieu of PHP for web tasks whenever possible (setting up server environments for Python-run websites can be a bit more involved compared to PHP).

For everyday problems that pop up which require programming to address, as well as for in-house auxiliary tools, Python is our #1 tool of choice due to the speed of development and maintainability. Things just get done so much faster and with much less pain when using Python.

Perl's unique feature of being extremely concise means that it will always have niche applications where it is the best language to use (being a Python fan, I would say might be better in certain niche situations than Python, but not by much) and is probably why it is still around, however you did say you were looking for a language that you can "apply to dev work to make life easier in general" and Python absolutely fits the bill here.

Try perlcritic and perl5i for easier Perl5 programming - Alexandr Ciornii
[+2] [2008-09-29 18:44:29] Joel Coehoorn

Python is quickly replacing perl for many as their language of choice. But that's partly because perl went for a very long time without a major update. I've heard that perl 6 could change this some. But I think I'd still go python.

Perl 5 had no major updates because it was quite stable and so flexible that many features could be implemented as libraries on the CPAN. Since your comment, the release cycle has been shortened and 5.10, 5.12 were out, and 5.14 is coming. - dolmen
[+1] [2008-09-29 18:41:06] workmad3

Python is more verbose, and by extension more easy to maintain.

Perl is very concise, and very quick to do useful tasks with. But it is more suitable for throwaway code rather than maintainable systems.

I'm not sure if I would call Python more verbose. It has stricter rules and conventions, but on the other hand it has much more powerful abstractions like list comprehensions and a much simpler notation for objects-oriented coding. - Dan
(3) Verbosity does not in any way imply maintainability, - JesperE
(2) Perl Regex's are more maintainable.…… - Brad Gilbert
[+1] [2008-09-29 18:56:30] user19087

Python for sure. Perl is great for quick scripts that you will never look at again. iPython alone is more than reason enough to learn Python:

iPython allows you to examine any object by using tab complete (ala the unix command line) which makes experimentation super fast and fun.

The standard interpreter has tab completion as well, but ipython is still a great tool to use. - André
[+1] [2008-10-26 15:41:18] Brian M. Hunt

Both are generic very high-level languages, with healthy ecosystems, sound methodologies and proven performance and reliability. There are good reasons to know both- Perl is a ubiquitous part of the web, Python is used in many important places (e.g. Google Apps). Humbly, here's my opinion:

Perl distinguishes itself by being astonishingly diagonal: there are a dozen ways to do any one thing. I think studying Perl could help one think about problems from different perspectives, it opens your mind to alternative approaches to one problem.

Python distinguishes itself by being extremely well designed and usable. It's easy to learn, has extremely intelligent design choices, and is an effective way to quickly build very usable projects.

Given your interest in making your development life easier, I'd recommend giving Perl a go. I consider it further from C/C++/Java than Python, and therefore it affords more opportunity to see things from a different perspective (which I feel is very valuable). It's also a glue language, and can be used everywhere for quickly solving problems.

[+1] [2008-09-29 19:49:54] Moshe

Guess it would be unfair to say you'd be better to learn both of them. Since I use both of them for work and for pleasure, I'll start with one major advantage of each:

  • Perl - Regular expressions. Most definitely the best language for quick text edits, string replacements, etc. After learning regexs in Perl, you'll understand it much better in other languages.

  • Python - Super quick modeling. Python could be useful to complete a task you're used to in C++/Java, in half of the amount of code (estimate), and 1/10th of the time (estimate). Sometime you'll stick with the Python result, and won't bother implementing it in a lower level language, since it's just good enough.

If you're doing more administrative tasks than other tasks - Perl it is. If not, and you have time for only one of them - Python.

Also, keep in mind that Perl's syntax is very much like C and Java, while Python is a whole different thing. Adding it to your resume would be a bigger plus than adding Perl.

Final note (don't want flame wars): every thing said is my humble opinion only.

[+1] [2011-03-14 11:39:51] LMB

I haven't deeply looked into Python, but I've been into Perl for two years (a begginer). My points:
* Perl is not a difficult language. On the contrary, it's pretty easy.
* Perl is powerful. I'm still being surprised how easy some things are done, in the style of

variable =~ s/'/"/g;

I only wish that Python was so easy.

[+1] [2011-07-13 15:48:01] plymouth

I would choose Perl over Python. I'am doing both. Done several big projects in Perl any in Python.

I must say that Perl is the more powerful language. Further, it has through the mighty CPAN libraries for just everything you could imagine. There is nothing what couldn't be done in Perl.

But then, Perl is more complex than Python. Symboltable for example needs a lot of understanding. If you know it you can develop just anything. Like the Moose Framework which is even more complete and functional than Python's OO System.

I like Python for its Syntax. It's a really good readable, but also uses more code than Perl. I like Python also for its big native library. It's also easier to learn than Perl.

If you need powerful language which is really efficient but also hard to learn than use Perl.

If you need language with really nice syntax and language which is mostly done in one good way then choose Python.

[0] [2011-03-16 01:58:31] Praveen

I am a scripting newbie although I've programmed in C/C++/F90 on parallel machines for several years (yes, a button pushing fluid dynamicist now benchmarking supercomputing applications). Very recently, I decided that I had enough of typing job scripts by hand (you know, you ask for 32768 cores and when the job finally starts after queuing up for a week, it crashes because of a blunder in the run script - very frustrating to say the least).

So I decided to write my scripts. It basically involves copying from a template directory and changing a few things here and there, diving into the input files. The biggest hurdle that I found was not so much difficulties in learning perl or python - they're both VERY easy languages, coming from a background of C/C++/F90/F77 and will get the job done.

But I find that with perl you can get the job done very quickly, from zero to productive user in 10 min - all that you need to know are $_s, variable declarations, a bit of regexing, etc. However, I've always found python much more daunting (been trying to learn it for a few years, but put it off) to write code on because there's just so much baggage - the strips, joins, import os.blah.bleh.foobar, self.glorification, etc

That being said, I got my scripts done using both perl and python. Python is of course, very easy to read (code is not too hard to read anyway, its only getting productive writing it that is problematic). I'd give a thumb's up for perl to start with - it's not only easy, but it can make you productive in no time, with so much less verbose manual BS. I won't bother about unreadable code and all that, at least not while getting started. It's never so bad, generally speaking (and the codes around don't really look all that unreadable anyway). I definitely find perl much more fun than python.

[0] [2011-06-16 11:12:49] saad khan

Perl has a large number of modules available in CPAN for almost anything. But if you are not following Perl best coding practices ( Damian Conway) as your bible of how to write a Perl code,things can get a bit dicey for you above 100 lines of code in Perl. While Python inherently makes it user to write beautiful code. One reason for this could be the ideology (There's only one way to do it).Thus python code is easier to maintain than Perl. In terms of performance Procedural Perl program will perform better than Python programs, the same cannot be said about object oriented Perl. Every Language has its own advantage over the other if you are going for data munging or file parsing you will find it easier with Perl as nothing beats Perl Regular expressions,while in graphics department Python is way ahead of Perl with good graphics libraries and numerous GUI frameworks like Wxpython( and PyQt(

Lastly IMHO Python has a steeper learning curve than Perl

[0] [2008-09-29 19:55:09] David Eyk
  • Python encourages code readability and maintainability. The significant white-space also appeals to my inner copy editor. Perl requires that you discipline yourself, or be satisfied with write-only code.

  • The Python standard library is excellent and, for the most part, well-documented. I don't remember how well Perl stacks up here. I do sometimes miss Perl's easy regexp handling.

  • Python has the Python Package Index [1]. The widespread adoption of setuptools [2] and easy_install as the package-management tools of choice, along with environment/dependency tools like virtual-env [3] and zc.buildout [4], make for a powerful and comprehensive development, testing, and deployment system. I always found Perl's CPAN just barely comprehensible, often leaving me on the verge of tears as yet another dependency noisily failed to install.


[0] [2008-10-01 12:45:30] niXar

Perl, the language, is a mess. But perl, the interpreter/VM, has an edge over python in that it is stackless (the language's calling stack doesn't use the system stack). As a result of this, Perl can do real shared memory threads while Python cannot. There is a stackless [1] python but it is experimental, not in the mainline source.

That is the most significant technical difference, and might not even matter that much anyway. Everything else is subjective, and a matter of personnal preference:

  • Perl has more libraries; Python has better ones. Edit: Perl's are more mature. For instance many Python programs at this time can't do SSL through HTTP CONNECT on a proxy.

  • More people know Perl; Python is used on more projects.

  • Perl has more documentation; Python's more usable.

  • Perl is installed on almost every *nix system; Python is a central part (system scripts, configuration dialogs) of most Linux/BSD distribs.

  • You can find third-party Perl APIs to almost anything; almost everything provides Python APIs.

Disclaimer: YAPH.


Nice and thoughtful insights. Thanks! - jpartogi
"Python has better ones. Edit: Perl's are more mature." What can that mean? Isn't 'mature' 'better' too? "Python is used on more projects" Where did you pick that from? Afaik, Python projects are growing at a faster pace, but the number of projects as such is greater in Perl. - sundar
(2) sundar: HTTP support is important, wouldn't you say? As I said, Python can't do SSL over an HTTP proxy, because it wasn't implemented yet (at least last time I checked, might have improved in the past few months). That's a pretty big feature missing. Perl's LWP doesn't have that kind of limitation. It's more mature. - niXar
[0] [2008-10-16 06:55:54] Friedrich

Well I find it a matter of taste. I've looked a bit at Perl wasn't all that happy with what I saw, I looked at Python and wasn't all that happy with what I saw.

However that's just me. Others have made good points for Perl, so be it. It's not useful to ask X vs Y; this is just asking for trouble. See the vi vs. Emacs stuff, Windows vs Linux and what all comes along.

One has to clearly admit that both Perl and Python are not just languages, but eco-systems. Both have unbelievable many libraries. CPAN can be named legend for packaging.

However there are few things where you do not have the choice. Let's take OpenOffice automation you can use C++, Java, JavaScript and Python. I do not have heard of any other languages in the UNO area. IIRC there is a Python on .NET but I can not remember having heard of a Perl there. I guess there are a few other areas where it's not Python vs. Perl. Let's look e.g at Debian, Perl is mandatory, you can not escape it. It's a base tool, that's not true for Python.

I'd argue that Perl is a very good match for the Unix tool chain, but Python is not far behind.

If you have the choice, choose what you like more. But if you know both, you definitly have more choices, and sometimes you have to know the other.

I for my part have choosen not to use either of them. My answer currently is neither Perl nor Python....


There is Perl on .NET - Alexandr Ciornii
[0] [2008-09-29 18:45:42] Corey Goldberg

Perl is also in a weird state of flux between versions. Perl 5 is heavily used, and Perl 6 has been in development since Larry Wall announced it in 2000! Perl 6 looks VERY different and I can't imagine an upgrade path will be painless once it finally arrives.

On the other hand, Python has been on a very defined path for Python 3.0 and we will see a release shortly.

(4) You're misunderstanding the role of Perl5 vs. Perl6. It's not your fault, it's the Perl6 marketing's fault: They're totally different languages. Perl6 won't replace Perl5. Perl5 lives happily alongside a future Perl6. Using Perl now does not mean you'll be stuck in five years with no upgrade path. - tsee
I think they are not totally different. There are many differences. There are similarities too. - Aftershock
(2) Larry wrote about his plans in aptly named "apocalypses." I read a few of them when they came out, so many years ago. It may be that the plan is to maintain Perl 5.x indefinitely after Perl 6 finally ships. However, the changes are drastic enough (and Perl is already idiosyncratic enough) that it will leave multitudes of users "stuck" with severe cases of cognitive dissonance. Just the changes from Perl5 to Perl6 "sigils" and "twigils" and completely different semantics regarding variables vs. references (everything is now a reference) is going to leave mere mortals apoplectic! - Jim Dennis
[0] [2008-09-29 18:44:23] Eli Bendersky

Both are good languages, but if you only start learning one of them now, go for Python. It currently has much more boost behind it, and much more new and cool stuff is being developed in Python than in Perl. By choosing Python, you're not missing anything because it can do anything Perl can do.

If you have specific application needs, specify them - because then the answer may change. Otherwise, just download the Python distribution relevant to your platform and read the tutorial.

[-2] [2008-09-29 18:45:45] davetron5000

Perl has a much easier regular expression mechanism to use and has been around for a while, having more mindshare and libraries.

Python is better for software engineering.

AFAICT, the regular expression syntax in Python is exactly the same as that of Perl, and intended to stay that way. I think this was a conscious and smart decision by the Python devs. - Dan
(2) No, regular expressions in python are a lot more hassle. A substitute regex such as 's,foo,bar,gi' is split up in python, you have to enter the search string, the replacement string and any flags seperately. re.sub() doesn't even accept flags, so you are forced to compile the regex first. - warpr
[-3] [2008-09-29 19:42:56] Bash

Interesting : [1]


[-3] [2008-10-04 02:02:45] warpr

Perl is fine if you use it regularly (e.g. at work). If you don't, it's just too hard to remember the syntax, there's a fair amount of magic characters in it to make the code unreadable if you don't use the language often enough.

If you do use the language regularly, it is a good choice. It allows you to write very dense/concise code, and perl gives you the freedom to do things the way you want to do them.

[-4] [2009-11-10 10:56:53] Jim Dennis

If you want to do anything with threads, memory mappings, objects (classes), or XML/SGML/HTML parsing ... Python will be far easier to learn and far more robust.

If you might need introspection or any sort of object serialization Python will provide it easily.

Spend 15 minutes with ipython (the "interactive Python shell" --- which is written in Python as a wrapper around the default Python interactive shell) and compare that to a Perl debugging session. (ipython is not part of the standard Python distribution; but the standard readline and rlcompleter modules gives you most of the features, without the ncurses color support. ipython just makes it prettier and even more convenient to try your code snippets interactively).

Read up on the multiprocessing module that's been added to Python 2.6 and pay particular attention to the support for process pools and queues. Briefly the multiprocessing module is modeled after the threading module, it usually nearly identical APIs but scales out using sub-processes rather than threads. The Queue() classes (again, nearly identical interfaces for inter-thread and inter-process) provides for coherent communications from one or many producers to one or many consumers. Used wisely these queues can be used as the primary synchronization as well as communications mechanism among threads or processes. Most locking issues (and race opportunities) are simply and transparently avoided.

For example earlier today I wrote a little utility to spawn a pool of processes (20 by default), a jobqueue and a resultsqueue. Each of the subprocesses ran a daemon-like loop to pull functions and arguments out of the jobqueue and feed the results back through the resultsqueue. From there it's a simple matter to feed function calls our, read results back in (some of which are then fed back through as arguments to a new function call) and so on.

That took about 10 minutes and about 25 lines of code. (The details of the functions and data I was processing are somewhat more complicated and proprietary; but the point is that this silly thing can be used for any Python functions or objects with any arguments. I didn't need to worry about object or data serialization, buffering nor any of that. The Queue() objects handle all that for me. (Since functions are first-class objects in Python I can feed a reference to a function through a Queue just as easily as any other data (objects).

(This particular task was more compute than I/O bound which is why Python's multiprocessing is preferred over threading. Many have said evil things about the GIL --- Python's infamous global interpreter lock --- but even more complaints have been heard about Perl's support for multi-threading).

(2) Try Devel::REPL in Perl for REPL and Moose for OOP. - Alexandr Ciornii