Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: passing subroutine arguments directly into a hash

by blakem (Monsignor)
on Oct 20, 2001 at 12:01 UTC ( [id://120237]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Re: passing subroutine arguments directly into a hash
in thread passing subroutine arguments directly into a hash

(well, technically its a list.... but thats for another day)

Another "a-ha!" moment is just one more step away. The '=>' operator is really just a glorified comma. It will quote simple barewords on the LHS, but thats the only difference. Consider the following:

my @a = (1 => 2 => 3 => 4); print "$_\n" for @a;
So, the somewhat unfamiliar:
(arg1=>$blah, arg2=>$blah2)
is really just a very familiar four element list:
( 'arg1' , $blah , 'arg2' , $blah2 )
dressed up with some syntactic sugar. (note the need to quote 'barewords' when using commas)

With this in mind, take another look at your hash assignment and named argument passing.....

-Blake

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://120237]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.