Would it be correct that @$self->{'column'} is trying to dereference $self first ...

My narrative would be that @$self->{'column'} is trying to dereference $self first as an array reference (it's not; it's a blessed hash reference).

... and then access the column key of the dereferenced value?

Once the attempt to dereference a hash ref. as an array fails, that's it: parsing cannot continue. If parsing went on, it would have to deal with an expression equivalent to
    @some_array->{'column'}
that makes no Perlish sense. Looked at another way, even if the proper hash reference dereferencing operator (the % sigil) were used, the expression would still make no sense (update: now; see Update below):
    %$self->{'column'}
is equivalent to
    %some_hash->{'column'}

Update: Well, actually... It dawned on me that a long time ago, in a Perliverse far, far away, this sort of expression did, briefly, enjoy some validity:

Win8 Strawberry 5.8.9.5 (32) Mon 03/29/2021 3:40:28 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings -l my %hash = qw(column vertical fence horizontal); print %hash->{'column'}; Using a hash as a reference is deprecated at - line 3. my @array = qw(column fence); print @array->[1]; Using an array as a reference is deprecated at - line 6. my $ar = \@array; print @$ar->[0]; Using an array as a reference is deprecated at - line 9. ^Z vertical fence column
(Update: Changed 5.8 example to include array reference; hash reference assumed to work similarly.)

As it was told to me, the history of this syntax is that it began as a bug and was elevated by use into a "feature." As you see, it persisted as late as Perl version 5.8, although even by then it was deprecated. By version 5.30, it was entirely extirpated:

Win8 Strawberry 5.30.3.1 (64) Mon 03/29/2021 2:54:54 C:\@Work\Perl\monks >perl my %hash = qw(column vertical fence horizontal); print %hash->{'column'}; Can't use a hash as a reference at - line 3. Win8 Strawberry 5.30.3.1 (64) Mon 03/29/2021 2:55:26 C:\@Work\Perl\monks >perl my @array = qw(column fence); print @array->[1]; Can't use an array as a reference at - line 3.

Of course, something like @$hash_reference has always been verboten.


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: Not an ARRAY reference error (updated) by AnomalousMonk
in thread Not an ARRAY reference error by Bod

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.