Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
h = {"one"=>1, "two"=>2, "three"=>3 } h["four"] = 4

Then again in most Ruby code it would be more idiomatic to use symbols instead of strings as the keys so it would come out as:

h = {:one=>1, :two=>2, :three=>3 } h[:four] = 4

which rolls off the fingers quite nicely in my opinion.

You can tell perl was written by a linguist -- there's more interest in making the language expressive, with natural shortcuts, rather than "pure."

Then why do I end up typing less when I use Ruby? :-)

Some things are shorter in Ruby than Perl. Some things are shorter in Perl than in Ruby. I certainly don't find Ruby more verbose than Perl. The opposite if anything.

Being able to convert input strings to numbers instantly is another nice shortcut. "Everything's an object" gets in the way of that in ruby.

It's not the everything-is-an-object bit of Ruby that gets in the way. Everything is an object in Perl 6 and it keeps the auto-conversion between numbers and strings.

It's a design decision on how those objects behave. For me it's six of one and half dozen of the other - neither option makes a huge difference to the way I code.

The worst thing is the complete lack of a protective mode like "use strict;" as I discussed here. Writing in ruby feels unsafe to me.

I have to admit that I too thought that this would be a problem, but I've found this a complete non-issue when using Ruby.

In reply to Re^2: Perl/Ruby comparison by adrianh
in thread Perl/Ruby comparison by srdst13

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (6)
    As of 2019-02-19 08:48 GMT
    Find Nodes?
      Voting Booth?
      I use postfix dereferencing ...

      Results (104 votes). Check out past polls.