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

Re^5: Preferred technique for named subroutine parameters?

by akho (Hermit)
on May 22, 2009 at 21:09 UTC ( #765754=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Preferred technique for named subroutine parameters?
in thread Preferred technique for named subroutine parameters?

Which is kinda useless if you're trying to pass this reference into a function.


Comment on Re^5: Preferred technique for named subroutine parameters?
Re^6: Preferred technique for named subroutine parameters?
by AnomalousMonk (Monsignor) on May 22, 2009 at 21:41 UTC
    Which is kinda useless if you're trying to pass this reference into a function.
    Well, if you're trying to pass a reference into a function and also have it be the name of an argument, yes.

    I wonder if you mean to pass a named parameter having a value that is a reference? Now, that seems to work pretty much as advertised:

    >perl -wMstrict -MData::Dumper -le "sub func { my %args = %{ $_[0] }; print Dumper \%args; print $args{foo}->{bar}; } func({ foo => { bar => 'baz' } }); " $VAR1 = { 'foo' => { 'bar' => 'baz' } }; baz

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-04-17 05:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (439 votes), past polls