develooper Front page | perl.perl6.language | Postings from April 2005

pass hash to sub expecting named params?

Thread Next
Carl Franks
April 25, 2005 01:14
pass hash to sub expecting named params?
Message ID:
Will it be valid to pass a hash to a subroutine expecting named
params, if the hash keys match the names?

sub do_this (+$foo, +$bar) {
  # whatever

%arg = (


I use this technique a lot, and it would be unfortunate to miss out on
the advantages of subroutine signatures and have to 'go back' to the
sub do_this (*%args) { }

Carl Franks

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About