in reply to Re^2: Only using scalers and references
in thread Only using scalers and references

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).

  • Comment on Re^3: Only using scalers and references