Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

As the other poster says, all punctuation has a certain amount of magic. Even if a given punctuation variable doesn't have any specific magic, it still has the general magic that applies to all of them. If you read the obfuscation section from time to time, you'll see people using punctuation characters to name not just scalars and arrays but also hashes. Certain punctuation characters are particularly popular for this, most notably underscore and semicolon. (%; makes for some good fun, particularly. $_{$_} is also interesting in the right combinations.) _ is also a legal name for a subroutine, though I'm not sure there's any magic in that case.

I believe the reason all punctuation variables are automatically magical is a combination of consistency and implementation details, but frankly it shouldn't be a problem in most cases, because if you don't want weird stuff to happen you shouldn't use weird variables; there are plenty of letters in the alphabet, after all, if you're a fan of the mundane.

In Perl 6, some of the special punctuation variables will be going away or changing, but the default arg is getting extended. In Perl5, $_ and @_ have special magic, but %_ is only magical in the general way; in Perl6, %_ will have special magic, as well. (I believe L.W. is using the term 'topic' for this.)

Another difference in Perl6: in Perl5, all punctuation variables are global. You can scope them dynamically (with 'local'), but you cannot scope them lexically (with 'my'). In Perl6, you will be able to scope them lexically (err, whichever ones are kept, that is; as I said, some of them are going away or getting changed, renamed, or otherwise adjusted).


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Re: Undocumented variable? by jonadab
in thread Undocumented variable? by dpmott

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (9)
    As of 2014-07-30 05:05 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (229 votes), past polls