Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Undocumented variable?

by jonadab (Parson)
on Sep 13, 2003 at 04:08 UTC ( #291214=note: print w/replies, xml ) Need Help??

in reply to Undocumented variable?

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$/

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://291214]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-01-19 05:39 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.