Keep It Simple, Stupid | |
PerlMonks |
RE: Merging hashesby Anonymous Monk |
on Jan 02, 2000 at 20:34 UTC ( [id://1662]=note: print w/replies, xml ) | Need Help?? |
Perl is very wise. I have not tested, but I assume that in the case of %foo = (%foo, %bar); that the values of %bar that share keys with %foo will over write the value in the cat and the value in the new %foo will be from %bar? Sorry that sentence was so long, I got caught up in the moment. I use this, not only to garuntee %bar will over write %foo, but so anyone who looks at the code after me will have no dougts as to what I was attempting:
It is iterative, but shouldn't consume too much memory. This will even pass pointers kept in values. I'm afraid a cat would expand the array I was pointing to aswell. I have never tried though. -T
In Section
Meditations
|
|