Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Masem's scratchpad

by Masem (Monsignor)
on Jun 03, 2004 at 14:24 UTC ( [id://360162]=scratchpad: print w/replies, xml ) Need Help??

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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-03-28 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found