Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by smls (Friar)
on Sep 26, 2013 at 10:07 UTC ( [id://1055806]=note: print w/replies, xml ) Need Help??


in reply to Re: 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?

Hm, good point.
I guess it could be made so that in case of an uneven sized list, it excludes the first item.

But that would break consistency with regard how uneven lists are usually interpreted as hashes, which I think is to exclude the last item and printing a warning.

Replies are listed 'Best First'.
Re^3: Why doesn't Perl provide %_ as the hash equivalent of @_ in subs?
by choroba (Cardinal) on Sep 26, 2013 at 10:16 UTC
    Or, maybe, the hash is created once you use the variable for the first time, so you can safely shift the $self or $class.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found