in reply to Re^5: 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.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
|
|---|