Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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?

Replies are listed 'Best First'.
Re^6: Preferred technique for named subroutine parameters?
by AnomalousMonk (Canon) 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?
[stevieb]: it's a long day when you want to make changes to a project and the entire test suite takes 2 hours to fully run :)
choroba knows the situation. At work, unit tests run for 30 minutes, and integration and end-to-end tests take almost one hour.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2017-03-26 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.