DB<12> use strict;print @$b Can't use an undefined value as an ARRAY reference at (eval 39)[/data/ +data/com.termux/files/usr/lib/perl5/5.28.2/perl5db +.pl:738] line 2. DB<13> use strict;print @$b=(1..3) 123 DB<14> p $b ARRAY(0xb0a92180) DB<15>

Using $a or $b triggers a special case for sort. This can be seen by using some other variable name instead:

>perl -w -Mstrict -E 'say @$b' Can't use an undefined value as an ARRAY reference at -e line 1. >perl -w -Mstrict -E 'say @$c' Global symbol "$c" requires explicit package name (did you forget to d +eclare "my $c"?) at -e line 1. Execution of -e aborted due to compilation errors. >perl -w -Mstrict -E 'say @$b=(1..3)' 123 >perl -w -Mstrict -E 'say @$c=(1..3)' Global symbol "$c" requires explicit package name (did you forget to d +eclare "my $c"?) at -e line 1. Execution of -e aborted due to compilation errors. >

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^2: Dereference of undefined value OK under strictures? by afoken
in thread Dereference of undefined value OK under strictures? by AnomalousMonk

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.