Ruby is a better Perl; it's closer to Perl than e.g. Python, it has fewer footguns but is also very expressive. It also has alternative quotes, backtick, shellescape etc. for ad hoc shell integration though you're better off learning IO.popen and others to take the shell out of the equation.
I still find Perl is better for some tasks (over Python - I don't know Ruby). It has loads of syntactic sugar such as globbing files, backticks for executing system calls.
I would argue that ruby as almost all the strengths of perl and conciseness with more coherency if you want a perl-like fluidity and terseness. I personally like python for anything that becomes more than a 100 lines of bash.
And while we're on the topic, Perl has pretty much everything both Python and Ruby have (and better Unicode support, to boot), though it's wrapped in syntax and idioms that most Pythonistas and some Rubyists find distressing.
For stuff like string handling, text processing and even variable interpolation, Perl blows Python and Ruby out of the water...
I agree on Python. I disagree for Ruby. It is a tossup. In most cases they are equivalent, Perl has autovivification, it is easier to interpolate functions into strings in Ruby. All in all it doesn't matter.
The fundamental difference is that Perl doesn't think itself beautiful. There's plenty to hate specific to Perl: sigils for types, noisy syntax (not even the #$@%, just the structure is ugly), nested lists always being flattened silently (as a design choice, Larry is crazy).
I never end up using Perl, the niche it occupies between shell and python is empty for me. I never have a problem with a shell script where I'm wishing for more control structures or builtins. The few times I've written long-running resource-intensive shell scripts (like brute-forcing an MBR partition scheme), reducing the number of forks wouldn't make them more than a few percent faster.
The major ray of light shining down on Ruby is that it is a Perl that people want strongly to write better looking code in. That's a pretty big accomplishment, I think. It seems like a lot of the classic Perl webdev shops are moving to Ruby, and I think that's pretty great.
I agree that Python and Ruby ate Perl, but for me they are not strictly an improvement. Just spoons of a different colour. Python is more novice friendly, but for someone who uses language every day it is not a problem to learn Perl syntax and BCP.
As someone who strongly dislikes perl (I'm being generous there really), I really don't think python or ruby do a better job at all. Python's selling point seems to just be "the syntax is different", and I honestly can't tell how ruby is supposed to be better than perl at all. It is barely even different.
A couple of the things that perl has over python and ruby... #1 is execution overhead, although that may have changed in recent times. #2 is that it's preinstalled on most linux/BSD OS's as a requirement for its plumbing, which makes it nice if you're trying to run a system on minimal dependencies.
It's ugly for all the reasons that people complain about it for but those are largely complaints and the rest of us have work to get done.
Oh yeah, and if you liked perl - I highly recommend learning AWK/SED. Even lower on the execution overhead (Can do shit in the processor cache and avoid memory allocation bottlenecks on enormous hundreds of gigabyte CSV datasets with a crappy processor in milliseconds kind of stuff)
For a shell substitute, though, Ruby and Perl are better due to their enhanced support for one-liners. Matz was smart enough to retain Perl's virtues when he created Ruby. Sadly Python has taken over in the same way that VHS killed-off Betamax.
If you're going to compare Perl with Ruby make it Perl + Moose then redo your benchmarks. Otherwise it's an apples to oranges comparison as Ruby has built-in OOP. Ruby was built on top of the best bits of Perl and with its blocks and metaprogramming it is arguably the most advanced scripting language. Python fails to match Perl and Ruby due to its half-assed lambdas.
This is the correct answer. Python and Ruby pretty much ate Perl's lunch. Depending on whatever you were working, one of those two languages, was almost always a strict improvement over Perl.
The only place really shines comparatively is in CLI one-liners. But even there, awk is usually a better tool.
I personally also use Python regularly and am very comfortable with it, but we often choose Perl because of the developer experience in it.
Perl has a reputation for being difficult to learn, and it does have a bit of a high learning curve compared to Python. However, once you learn Perl, you'll find it's a rather wonderful, expressive. and powerful language.
Is it "better" than Python or Ruby? No, just a different solution to many of the same problems. If we're being honest, most anything you can do in Ruby or Python can also be done in Perl.
My experience is that most engineers and devs over the age of ~30 know Perl front and back (if they script), so it's a natural choice. Fewer of these people (in my experience) are as familiar with Python/Ruby.
Perl continues to evolve and the Perl we wrote in 1998 isn't the same as the "Modern Perl" we write in 2014. There are great modern Perl web frameworks (Dancer, Mojolicious), real object-orientation via Moose, powerful exception handling via Try::Tiny, and a history of excellent database support.
reply