Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-03-19 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found