Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

"%_<filename" has a purpose in the debugger (see %DB::dbline), and that may be what the author of the patch meant by "the %_ hack".

I also noticed that the module "English" assigns the whole typeglob (*_) to the name "ARG", i.e. @ARG becomes equivalent to @_, $ARG equivalent to $_, and therefore %ARG becomes equivalent to our mysterious %_. This further bolsters the theory that it's just a leftover from the others in the same typeglob.

> Since _ variables ($_, @_) hold arguments, would %_ make
> intuitive sense to you as "the variable holding
> named arguments"? It really was a random thought, but
> since I thoroughly enjoy learning idiomatic Perl, this
> idea struck me with some force.

Doesn't seem intuitive to me, sorry. I prefer named variables.

> Other than declaring it local (which suggests some deeper
> meaning in and of itself), how would you feel about
> code (a subroutine) which stores its named arguments
> in %_? Does this help or hinder self-documentation?

Definitely hinders. In general, you want to stay away from using global special variables in the way that they were not intended, even if they appear as if they are not being "used" at the moment. Future versions of perl may do something with the %_ hash - who knows? The whole reason you cannot declare it with 'my' is because it is a special global variable. You can localize these, but not "my" them. Better to just create something like %subargs, or even %_subargs if you really like the underscore. :)

Finally, as to your lack of editing problem, try complaining at the Editor Requests section. It may be a bug in the code, as sometimes (albeit very rarely) I cannot edit my own nodes either.


In reply to RE: Re: What is %_ by turnstep
in thread What is %_ by Russ

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 musing on the Monastery: (8)
As of 2024-04-18 16:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found