Would you have such conceptual trouble if the syntax were instead:

store_into( array_foo, list_of_values (1, 2, 3) ); store_into( scalar_bar, array_reference( list_of_values( 1, 2, 3 ) ); store_into( scalar_baz, last_expression_of_list( 1; 2; 3; ) ); store_into( array_biz, array_reference( list_of_values( 1, 2, 3 ) );

I'm not suggesting that's great syntax or that it's even clear syntax, but I am suggesting that that's effectively the way you have to think about the code if you want to understand what it's doing. (That also explains why your interpretation of the third case is incorrect.)

Is it inconsistent? I don't think so. All four are doing different things and all four look very different. As you suggest, it's similar to the difference between Python tuples (immutable) and lists (mutable). They may look similar if you don't pay attention to the brackets, but they look different because they behave differently.


In reply to Re: Some Insights from a Traveler Between Languages by chromatic
in thread Some Insights from a Traveler Between Languages by skyknight

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.