[Thousand-oaks-pm] Perl hash question

Robert Hull rhull2k at earthlink.net
Thu Dec 1 21:41:51 PST 2005


I'm looking for a succinct way to join two hashes.  What I would like is:

%foo .= %bar ;

Where %foo retains it values for keys undefined in %bar
and
%foo takes %bar values for keys defined in %bar.

Maybe I do not know an obvious way of doing this.  The best I found is:

my @temp = %foo ;
push @temp,%bar ;
%foo = @temp;

Just wondering if a better way exists?  Does my solution have unexpected 
side effects?

Robert 




More information about the Thousand-oaks-pm mailing list