Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: Why doesn't Perl provide %_ as the hash equivalent of @_ in subs?

by ikegami (Pope)
on Sep 26, 2013 at 14:16 UTC ( #1055843=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Why doesn't Perl provide %_ as the hash equivalent of @_ in subs?
in thread Why doesn't Perl provide %_ as the hash equivalent of @_ in subs?

It's possible to alias hash values.

$ perl -MData::Alias -E' @_ = ( a=>4 ); alias %_ = @_; $_[1]=5; say $_{a}; $_{a}=6; say $_[1]; ' 5 6

However, copying args is a good thing. That's why we don't access @_ directly.


Comment on Re^4: Why doesn't Perl provide %_ as the hash equivalent of @_ in subs?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2015-07-02 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (31 votes), past polls