in reply to Re: passing two hashs to a subroutine
in thread passing two hashs to a subroutine
To answer your immediate question, you've already got it right. Your example is exactly how you'd pass two hashes to a subroutine...
Actually, that's wrong. Passing 2 or more hashes (or arrays) into a sub that way causes them to be flattened into a single list, which means it isn't possible to separate them once inside the sub.
main::(-e:1): 1 DB<1> %h = ( a=>1, b=>2, c=>3 ); DB<2> %i = ( x=>1, y=>2, z=>3 ); DB<3> sub test{ my( %h, %i ) = @_; print '%h: ', scalar keys %h, ' % +i: ', scalar keys %i; }; DB<4> test( %h, %i ); DB<5> %h: 6 %i: 0
|
|---|