Public Scratchpad | Download, Select Code To D/L |
for jc:
SCALAR includes CODEREF, GLOBS, and anything else besides ARRAY and HASH Argument Precidence Order for merge($a, $b) ( No data is lost from the $a arg, some might be from $b ) left arg ($a) -> SCALAR ARRAY HASH right arg ($b) V SCALAR $a join @$a, $b $a (*) ARRAY $a join @$a, @$b $a (*) HASH $a join @$a, values %$b merge (%$a, %$b) ----- Storage Precidence Order ( Aim to keep most 'complex' elements in place ) left arg ($a) -> SCALAR ARRAY HASH right arg ($b) V SCALAR $a join @$a, $b $a (*) ARRAY join @$b,$a join @$a, @$b $a (*) HASH $b (*) $b (*) merge (%$a, %$b) ----- Maximize Retainment Order ( Avoid losing any data, may change scalars to arrays, etc) left arg ($a) -> SCALAR ARRAY HASH right arg ($b) V SCALAR ($a, $b) join @$a, $b %$a + hashify($b) ARRAY join @$b,$a join @$a, @$b %$a + hashify(@$b) HASH %$b + hashify($a) %$b + hashify($a) merge (%$a, %$b) (*) Possible 'hashification' where a scalar, or each scalar in an array, is added to a hash with key == value == $scalar. In this case, another merge is called on the existing hash and the new hash.