in reply to How do I push values onto an existing hash?

Here's one way,

my %param = ( apples => 'green', banana => 'yellow', @_ );
Since you have a default for the banana key, you shouldn't need to check its existence.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: How do I push values onto an existing hash?
by jaa (Friar) on Jul 10, 2003 at 10:39 UTC

    > don't have to test the banana

    unless of course I called it with

    abc( banana => undef, eat => 'mon' ); sub abc { my %param = ( apples => 'green', banana => 'yellow', @_ ); # now just have to figure out the 'mon' key... # and the banana colour! }
    Thanks for both suggestions! doh! 8-)