in reply to Merging hashes (clobber duplicate keys)

I find that @$a->{ EXPR } won't work, because it expects $a to be an ARRAY ref. @{ $a }{ EXPR } should be used instead.

Here's a slightly shorter version of your code: @{$a}{keys %b} = values %b; keys and values always return their results in corresponding order.

Replies are listed 'Best First'.
Re: Re: Merging hashes (clobber duplicate keys)
by dkubb (Deacon) on Feb 07, 2001 at 07:39 UTC
    Here's an even shorter version: =)

    @$a{ keys %b } = values %b;
Re: Re: Merging hashes (clobber duplicate keys)
by baku (Scribe) on Feb 07, 2001 at 01:31 UTC

    Re:  @{ } Mea culpa ...

    That final code must be what I was trying to get my brain around. I knew there had to be a way without a temporary var... Thanks greatly.