Right folks! Time for another religious war. Or, a Halo style three way battle.
On the left, we have Perl, the grand-daddy of the scripting world. But don’t let his age fool you, he still has a few tricks up his sleeve.
On the right we have Ruby, the young kid on the block. He may be the youngest, but he sure knows how to throw his weight around.
In the middle we have Python. Entering middle age, his pot belly is beginning to show, but get too close, and he’ll knock you out in one.
Come ladies and gentlemen, place bets. Who will win?
Python vs Ruby vs Perl – Which is the best?
Sorry to disappoint you so early, but there is no clear answer. It all depends on your personal preference.
Perl was one of the first scripting languages (at least, if you count the modern ones that are still used). It grew organically– a group of small utilities Larry Wall wrote for himself, and released for general use. Perl became very popular and grew very fast, but this also led to its main problem- it is messy and unorganised, because of its free and hippie nature.
⊕ One of the oldest scripting languages still being used. Well supported.
⊕ CPAN is one the best way to install Perl libraries. It is central, has a huge collection, and is easy to use. Compare with Python, where there are 20 different ways to install libraries (so much for the one way to do it).
⊖ Perl is messy. It encourages you to write quick and hack code. Although it doesn’t force you to, the fact that it makes it so easy to write quick scripts means many people do exactly that. I found it hard to read my own Perl scripts after only a few months.
Python is seen as an easy to learn language, which is why its the preferred language for beginner courses. For the same reason, it is popular with scientists and engineers- Pythons engineering libraries are among the best, and many scientists now prefer it to Matlab (as it is free, and more powerful than Matlab).
⊕ Python is really easy to learn and read.
⊕ It has some of the best libraries – for engineering, writing games, image processing, machine learning amongst a few things.
⊖ Python’s habit to force you do stuff its way can get a bit irritating at times. You just want to try out a quick script, and Python will force you to indent everything. It also has fewer programming constructs compared to Ruby (Python has just a while loop, while Ruby has an until and do-while as well).
Ruby is a language that was built for programmers. It is powerful and easy to use. And its a lot like Python.
⊕ Ruby is the choice for web programming. Ruby on Rails is the choice for web frameworks, and has some really cool tools (IDEs, cloud hosting). Because of its coolness factor, most companies support Rails first, and add Python later on, usually in a half hearted way.
I don’t see many negatives in Ruby, though maybe because I haven’t used it much. There is one big one for me though:
⊖ The irritating and obnoxious crowd, who just won’t shut up about how great Ruby is. A bit like the Git crowd.
Python vs Ruby?
Why not both? They are fairly similar, and you can learn both quickly and easily. The reason for learning both is that some great libraries are written in one or the other, and if you know both, you can easily switch between the languages (while still keeping one language as your main choice). This is my recommendation.
Related: Scripting languages come to dinner