Well yes that's how it's implemented in Perl - and other languages like Python or JS too - but doesn't help comparing languages.

They all store references into their "namespaces" or "lexical pads"

...

and anonymous" only refers to the literal array or {hash} constructors not to the scalar on the LHS of an assignment.

perldata states:

Values are usually referred to by name, or through a named reference.

So the LHS in $ary = [1,2,3] is a named reference; it is a named variable. The RHS is an anonymous array, at least that is what is called throughout the perl documentation. So let's stick to that to avoid confusion.

The difference is not "named" or "unnamed", but explicit or implicit dereferencing.

Difference between languages, but not in perl.

In perl, the scalar $ary may hold an anonymous array. But @ary is a named array. Perl does no implicit derefrencing, and so the syntax to access slots of the named array @ary necessarily has to be distinct from the one to access a slot of the anonymous array stored in the named scalar variable $ary - or of any anonymous array:

my $result = [ func(@args) ]->[2];

So in perl - at least that is how I understand perl for a couple of decades now - the difference is between named and anonymous variables. To get hold of an anonymous variable beyond a single statement, its reference has to be stored in a named scalar variable.

But I'm not going on telling you stuff you know as well as I do, only to get reverse 'halb' back, and I won't argue any more, since there is no point but frustration. Let's close this sub-thread. Thank you.

update

°) or scalars, but this can't be easily written *scalar = \1 is not the same thing

Of course not, because that makes a reference from a constant. A variable reference is needed to make it variable:

*scalar = \do { my $x = 1 };

The expression *scalar = \"foo bar" creates a package constant (readonly package variable) $scalar (but *scalar = \"Hello $world" doesn't, it's r/w :-).

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re^10: Thx, St. Larry, for the Beauty of Sigils by shmem
in thread Thx, St. Larry, for the Beauty of Sigils by msouth

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.