the reference arrow (->) was created so that perl can do all the stuff that most modern languages do by default

First, I think the ability to take references and to dereference them has existed for longer than the "reference arrow".

Second, references have existed in Perl at least since 1994, before Java and JavaScript even existed.

Finally, you seem to be confusing references (pointers on which arithmetic cannot be performed) and passing by reference (changing a parameter in a function changes it in the caller). Perl always passes by reference.

that most modern languages do by default

What "most modern languages" do is a bad thing. It's a compromise to increase program speed. Perl6 has many improvements in that area.


The rest of this post is a getting off-topic. Just some nits.

you can't pass a hash or array into a sub - it get 'flattened' into a scaler

It's spelled "scalar".

And they evaluate to (aka "flattened into") a list, not a scalar.

references are the simplest way to get a hash of hashes

A "hash of hashes" is really a "hash of references to hashes".

though if you pass a reference of a hash in there it survives perfectly intact

That hash survives perfectly intact either way. The difference is in what the function receives (a list of keys and values vs a reference).


In reply to Re^3: Only using scalers and references by ikegami
in thread Only using scalers and references by stevesnz

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.