in reply to Merging hash
Be aware that if the two smaller hashes contain the same key, then the value that ends up in the composite hash will depend upon the order you list the smaller hashes in the composing statement:
@val=({23=>1, 43=>1, 34=>1, 66=>1, 99=>1},{33=>1, 64=>1, 35=>1, 54=>1, + 78=>1});; pp \@val;; [ { 23 => 1, 34 => 1, 43 => 1, 66 => 1, 99 => 1 }, { 33 => 1, 35 => 1, 54 => 1, 64 => 1, 78 => 1 }, ] $val[2] = { %{ $val[0] }, %{ $val[ 1 ] } };; pp \@val;; [ { 23 => 1, 34 => 1, 43 => 1, 66 => 1, 99 => 1 }, { 33 => 1, 35 => 1, 54 => 1, 64 => 1, 78 => 1 }, { 23 => 1, 33 => 1, 34 => 1, 35 => 1, 43 => 1, 54 => 1, 64 => 1, 66 +=> 1, 78 => 1, 99 => 1 }, ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Merging hash
by arivu198314 (Sexton) on Oct 04, 2011 at 11:19 UTC |