in reply to 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 and get a hash as a result. That having been said, it's not the best way to do it mind you. As others have pointed out, using hash refs would certainly be the way to go here.

Update: Er, don't know what I was smoking when I posted that. Please disregard.

-- vek --

Replies are listed 'Best First'.
Re: Re: passing two hashs to a subroutine
by BrowserUk (Patriarch) on Oct 18, 2003 at 20:42 UTC
    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

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!