Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Perl Vs Ruby

by Dhanasekar (Acolyte)
on Nov 26, 2008 at 11:09 UTC ( #726075=perlquestion: print w/ replies, xml ) Need Help??
Dhanasekar has asked for the wisdom of the Perl Monks concerning the following question:

For a long period of time it is just wavering in my mind on finding which is the better programming language, Perl or Ruby. I navigated through the site and found that it is suggested to use Ruby

http://en.wikipedia.org/wiki/Comparison_of_programming_languages

And Perl is meant only for Text Processing and Scripting (for some administration activities ) But yet I have a feel that Perl is more powerful !! Isn't it ? Can any one direct me on understanding the details on this further ?

Need a clear understanding on which is better suitable for Enterprise kind of Application ??

Comment on Perl Vs Ruby
Re: Perl Vs Ruby
by jettero (Monsignor) on Nov 26, 2008 at 11:30 UTC
    Since the languages serve exactly the same role, it's silly to try to figure out which is "better" without talking about personal taste. For instance, I happen to think pizza is better than hamburgers, but I don't think there are metrics to describe that. Salt content? I find various syntactical problems with ruby entirely rule out the language for my own personal uses, but that's purely a matter of taste.

    -Paul

Re: Perl Vs Ruby
by rovf (Priest) on Nov 26, 2008 at 12:04 UTC

    Having done projects in both languages, I don't think you will find a clear advantage in one or the other when it comes to power of expressiveness. As it was already said, it is a big matter of taste.

    For instance, I like very much with Ruby that Arrays and Hashes can be dealt directly instead of going via references, and that classes are "first class values". At the moment, an advantage of Ruby (depending on your application) might be that there is also a Java implementation of Ruby available (JRuby), which makes it easy to interface to Java classes.

    On the other hand, I don't like some aspect of scoping rules in Ruby.

    For both languages, I found the community very friendly, so it is comfortable for a beginner.

    For people not knowing either language, I have the impression that Perl is easy to lear, while Ruby is very easy to learn. I got this impression from talking to various people who actually started with one or the other languages, plus my own impression. If you find the time, implement some small task in both languages and decide which you like better.

    -- 
    Ronald Fischer <ynnor@mm.st>
      For people not knowing either language, I have the impression that Perl is easy to lear, while Ruby is very easy to learn.

      I don't know about Ruby, but I disagree that Perl is easy to learn. Perl has tons and tons of features, quirks, special cases, and its own lexicon of idioms. On top of that, many simple tasks can be done in a diverse set of ways. In my experience as a teacher of both Perl and non-Perl languages, that makes Perl hard to learn. Many languages can be taught in a 3 or 4 day course. If I give a 5 day Perl course, I feel I've barely scratched the language.

      Now mind you, I don't think that a language that's hard to learn makes it worse. It's easy to learn how to handle a wheelbarrow, and it's a lot harder to learn to drive an 18 wheeler truck. But that doesn't mean the wheelbarrow is better at hauling.

        I don't know about Ruby, but I disagree that Perl is easy to learn. Perl has tons and tons of features, quirks, special cases, and its own lexicon of idioms.

        Maybe I should have been more precise here. I want to say: It is easy to get quickly to a point where you can write useful programs. Of course by then you know only a small subset. For instance, I wrote my first useful Perl program after having read about 3-4 hours the introduction in the Camel book. Before that, I wrote programs in C++, C, Tcl, ksh, Pascal and some other languages. I found that with Perl I became productive quickly.

        With Ruby, I found it somewhat faster to "go productive" and the language seems to me easier for beginners. I was teaching an absolute beginner Ruby as the first programming languages, and after maybe 10 hours in total, she was using it to write a 50+ line program which actually solved a concrete task (not a toy problem).

        In this respect, both Perl and Ruby are easy to start with, I think. But any language with a lot of features take time to learn. Even languages with a simple syntax, like Java or Lisp, do. With those languages, the "experience" needed to master them is in understanding the libraries, respectively the functions.

        May I ask you which languages you consider as simple to learn?

        -- 
        Ronald Fischer <ynnor@mm.st>

        I think you and rovf are both right. Perl is extremely easy to dive into and use but terribly difficult to master. I wrote my first production code 2 weeks after picking up the Llama 10 years ago. 10 years later I still learn new things here at least weekly. This is part of Perl's charm for me. It's exactly as useful/difficult/easy/productive as you have the interest to make it. Its payment curve coincides with its learning curve.

Re: Perl Vs Ruby
by jonadab (Parson) on Nov 26, 2008 at 12:13 UTC

    To me, one of the most important advantages of Perl is the CPAN. Most languages haven't got anything that can compete with that (though I don't know about Ruby specifically).

    -- 
    We're working on a six-year set of freely redistributable Vacation Bible School materials.
Re: Perl Vs Ruby
by LanX (Canon) on Nov 26, 2008 at 12:49 UTC

    I like Ruby a lot, IMHO it's syntactically cleaned perl dialect with some python specific features.

    And it's really amusing how the ruby hype sucks the snake community ! 8 )

    But

    • no CPAN like perl
    • much slower than perl
    • by far not as widespread as perl

    maybe in some years Ruby might be mature enough, but hopefully at that time perl 6 is available.

    IMHO who masters perl has no problem dealing with ruby, but not vice versa.

    so the strategic decision is up to you!

    Cheers Rolf

    UPDATES:
    () changed to more diplomatic metaphor ; )
    () maybe not? -> 726161

Re: Perl Vs Ruby
by BrowserUk (Pope) on Nov 26, 2008 at 13:14 UTC
    I navigated through the site and found that it is suggested to use Ruby

    Ignore them. Use Perl.

    There, now you have two opinions. Are you any the wiser?

    • But yet I have a feel that Perl is more powerful

      Define "powerful"?

      (Hint:Anything you can do in Perl can be done in Ruby. And vice versa.)

    • Need a clear understanding on which is better suitable for Enterprise kind of Application ??

      Define "Enterprise kind of Application"?

      (Hint: The term 'enterprise' in this context, is a label applied by the marketing men of expensive software to stroke the ego's of those they are trying to pursuade to pay their over-inflated prices.)

      Industrical strength software can be written in any general purpose programming language from assembler to Haskell. The defining factors include (but are not limited to), the expertise of the programmers; the thoroughness of the design; the rigour of the testing; the complexity of the application; the simplicity of the solution; the maintainability of the codebase.

      And the measure of all of these is a) subjective; b) much more reliant upon the procedures, practices and practitioners of the given implementation, than the language of implementation.

    If you seriously want to arrive at a conclusion of which you personally prefer, (rather than just bear-baiting), then pick a moderately complex application and try to develop Perl and Ruby solutions to the same specification.

    Depending upon the application; your own development and languages experience, (or that of your development team(s)); and the practices and procedures you (they), use; you will probably arrive at a conclusion quite early in the development.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Define "powerful"?

      Powerful refers to the community, CPAN, and support which is widely available in Perl than Ruby


      Define "Enterprise kind of Application"?

      I mean enterprise in the way the application works. In enterprise there will be process overhead 24/7. In this case the performance and resource usability should be considered. But in the case of Text Processing and Scripting, the program is not expected to run all the time.


      Ignore them. Use Perl.

      succinct and powerful!!



      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Re: Perl Vs Ruby
by EvanCarroll (Chaplain) on Nov 26, 2008 at 16:05 UTC
    I don't think they compare, off-the-shelf Perl without access to Moose blows. Moose makes complex tasks bearable and offers some nifty functionality that even surpasses off-the-shelf Ruby. I tend to lean perl, even though I dislike the bad-practice by default. Here is a good template to make perl suck less than Ruby.
    use Moose; use autodie; use features ':5.10'; use mro 'c3'; ## Module starts here. no Moose; __PACKAGE__->meta->make_immutable;


    Evan Carroll
    I hack for the ladies.
    www.EvanCarroll.com
Re: Perl Vs Ruby
by runrig (Abbot) on Nov 26, 2008 at 16:08 UTC
      Actually, that cartoon may assist with your decision. If you use Ruby, then you have to talk in a silly accent, but you do get a comfy chair. If you use Perl, then you have to stand up, but tea is provided. Either way you get to look down upon anyone who talks about requirements.

      On second thoughts, maybe not.

      --
      .sig : File not found.

Re: Perl Vs Ruby
by ptoulis (Scribe) on Nov 26, 2008 at 16:11 UTC
    As many fellow monks have said, it is really a matter of taste. Ruby is hot right now, no doubt, perhaps hotter than Perl. However, Perl is much more mature and has CPAN. So I guess both are great for building the so called industrial-strength applications.

    Technically Ruby is yet-another-language that copied Perl and added a complete object system (which came late in Perl). Its syntax is pretty much a ripoff from Perl. This is why Larry Wall considers it the biggest 'threat' to Perl's 'ecological niche'.

    So I guess this is why it is a matter of taste. There is no much distinction in technology (they are both dynamic, general-purpose languages), no difference in speed( Perl is a little faster), and also both are supported by vibrant communities.

    I will stick with Perl because I know it is THE one of its kind. It took others a decade to fully realize the real power of the language and now that we have all these clones around, perhaps Perl 6 will be the next big thing.
      > no difference in speed( Perl is a little faster),

      Interesting! The last benchmark I saw showed a factor 3 difference. Do you please have a source or link for me with newer results? 8 )

      Cheers Rolf

      UPDATE: added smiley

        A factor 3 isn't really that much of a difference, considering that with both languages you can/must switch to C/C++ for CPU-heavy work, which will fairly easily give you a factor 20 .. 100 speed increase, depending on the problem.

        update: I might as well throw my opinion on Perl vs Ruby in here.

        Ruby is slower than Perl, but neither should be used if pure raw speed is your ultimate goal.

        Ruby has some nice idioms in the core library that are open for anyone to use and extend. Ruby's iterator/collection idioms are particularly nice compared to perl's mess of for(each) / while ... keys ... / whatever interface some CPAN module implements.

        Perl has a larger range of modules in CPAN. Ruby modules are not organized in one place, so that means it's harder to find good quality extensions that do what you need.

        Ruby's built-in OO interface is a LOT better than Perl's (which probably also explains why perl's standard collections suck so much).

        Ruby has reasonably nice syntactic sugar for functional constructs. Perl has less of that, but it does offer a more consistent way of creating and passing functions.

        Neither language has serious threading support - though Perl's ithreads are fairly easy to integrate with C/C++ pthreaded code.

        Personally, if I wanted to create something large using a lot of OO that's not all that CPU critical, I'd probably go for Ruby over Perl, because Ruby looks better (especially OO code). If it also needs to be FAST, I don't know what I'd use - Common Lisp maybe, or Java, or C++, or possibly Clojure.

        The last benchmark I saw showed a factor 3 difference

        Do you really consider a 6,000-times-repeated call of one function, on a 500MHz machine, to be a language benchmark? Please, don't.
      Perl is much more mature and has CPAN.

      Well, Ruby has rubyforge instead. Most stuff at rubyforge is now stored as so called "gems", which makes them convenient to install.

      I didn't count the modules on CPAN and rubyforge, but I think CPAN has more to offer, since Perl has much longer history. Still, the module base on Rubyforge is pretty big (http://rubyforge.org/softwaremap/trove_list.php).

      -- 
      Ronald Fischer <ynnor@mm.st>
        > I didn't count the modules on CPAN and rubyforge

        Well he did, but don't forget to read the replies... 8 )

        Cheers Rolf

Re: Perl Vs Ruby
by Your Mother (Canon) on Nov 26, 2008 at 19:10 UTC

    But yet I have a feel that Perl is more powerful

    And faster, and more widely distributed, and required in more jobs, and better supported, and with a drastically larger base of quality, 3rd party code, groups, and communities, and more flexible, and...

    That said, I know a few strong hackers who have drifted from Perl to focus on Ruby. I won't be one of them though. :) If current events matter, I start a new gig with Perl in two weeks, finish a high paying telecommute one this week, and have been contacted by recruiters, unsolicited, seven or eight times this year for Perl jobs (and I consider myself junior in Perl chops to *many* of the monks here; stick around, I owe a good slice of the dev chops I do have to this place).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://726075]
Approved by almut
Front-paged by almut
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2014-11-26 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (165 votes), past polls