%_ is a special snowflake like $_ and @_

If by special snowflake you mean a punctuation variable, then yes.

Yes, %_ is an invalid names for a lexical, but that's the case for all punctuation variables.

Yes, %_ is strict-exempt, but that's the case for all super-global variables, and all punctuation variables are super-global variables.[1]

So there's nothing special about %_ specifically, so it makes no sense to document %_ specifically any more than it does to document $x. It works just like every other variable of its class.

I could swear I saw it somewhere once upon a time

Perl has never used %_. Its existence is a side effect of how super-globals are implemented: Symbols are made super-global, not individual variables. This means that $ENV, @2, %$ and &_ all similarly exist as super-global variables.


  1. All package variables are visible everywhere, making them all globals. By super-global, I mean that an unqualified reference to this variable looks for the symbol in `main` instead of the current package, so all unqualified references access the same variable regardless of the current package.

In reply to Re^5: perldoc -lf anomaly (%_) by ikegami
in thread perldoc -lf anomaly by Anonymous Monk

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.