I hit upon the right search terms somewhere. The crucial pointer was from ambrus of these precincts, in Re: What is true and false in Perl?. He pointed to the perlsyn man page. The current version says, at http://perldoc.perl.org/perlsyn.html#Declarations,

The only things you need to declare in Perl are report formats and subroutines (and sometimes not even subroutines). A variable holds the undefined value (undef) until it has been assigned a defined value, which is anything other than undef. When used as a number, undef is treated as 0 ; when used as a string, it is treated as the empty string, "" ; and when used as a reference that isn't being assigned to, it is treated as an error. If you enable warnings, you'll be notified of an uninitialized value whenever you treat undef as a string or a number. Well, usually. Boolean contexts, such as:

my $a; if ($a) {}

are exempt from warnings (because they care about truth rather than definedness). Operators such as ++ , -- , += , -= , and .= , that operate on undefined left values such as:

my $a; $a++;

are also always exempt from such warnings.

I believe that "when used as a reference that isn't being assigned to, it is treated as an error" is inaccurate or out of date: autovivification happens and is not an error (unless, I'm told, you use the no autovivification pragma).

Also, I think it's easier to explain boolean as being a scalar context that does not "treat undef as a string or a number", so the fact that it doesn't provoke a warning falls out as a consequence.


In reply to Re: When DOESN'T "Use of uninitialized value" show up? by Tim McDaniel
in thread When DOESN'T "Use of uninitialized value" show up? by Tim McDaniel

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.