I've been programming in Ruby for a couple years now (after having programmed in Perl for over 15 years), so maybe I'm qualified to give some anecdotal testimony (which will basically confirm what fullermd said above).

It seems like Ruby is a sort of middle-ground between Perl and Python: it actually borrows some idioms directly from Perl (including the command-line options that allow for really nice one-liners), and like Perl, it has a fairly strong (and seemingly popular) presence for web developers. But like Python, it's firmly and fundamentally object oriented.

If you happen to deal a lot with Unicode (non-ASCII) text, you'll like Ruby v2, because utf8 character handling is there "by default" - just open a file and read or write text in any language without further ado. (Opening a non-text file in binary mode is no harder here than in any other language.) Once you get your head around using (and chaining) method calls on objects, the code can become relatively compact compared to Perl.

Alas, it doesn't necessarily make the code any more easy to read or write, if you haven't memorized the relevant facts about all the various objects, or grasped the finer details of syntax and punctuation. (I'm tempted to refer to some patterns as "syntactic gristle" as opposed to "syntactic sugar.") The core documentation for Ruby is okay (not as clear or complete as Perl's, but not bad). Third-party module documentation typically stinks, if there's documentation at all. (A lot of Ruby module developers seem to think that "look at the source code" should be all the documentation anyone will ever need.)

Yes, there is a place where you can search for freely available Ruby modules that do useful things, but it doesn't hold a candle to CPAN in terms of breadth and ease of search, and some of the "nearly core" modules (covering things like database connections and XML parsing) have documentation that seems unduly maze-like to the newcomer. And then there's the occasional clunker, like the "zip file" module with a really bad memory leak. But maybe it's just a matter of time - Perl has been around somewhat longer. (Then again, Perl has had really good documentation since the early days, and subsequent developers have been following a well-established good example. Ruby's start-up and subsequent developers, not so much.)

Apart from having a user community that appears to be better at sharing, documenting and peer-reviewing code, Perl has a notable advantage for doing arbitrary data structures (HoAoH in Ruby is not so easy). Of course, it may just be that Perl seems better to me because after all these years, I've gotten really used to it.

Lately, when I have to do quick, one-off things on the command line, I find that some tasks are easier in Ruby, and other things are easier in Perl, and I choose accordingly.

(updated to fix a typo)


In reply to Re: Honest question about Perl, Python and Ruby by graff
in thread Honest question about Perl, Python and Ruby by madM

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.