turo has asked for the wisdom of the Perl Monks concerning the following question:
Hi, monks!
I'm wondering if some of you know if exists an effective trick for copying a hash. I mean, does exists some method that allows to duplicate a hash or an array, entirely, creating new references when necessary (not copying the references)? ...
(difficult to explain ...)
For example, if i have this array:
Which is compossed by two references to other arrays (ARRAY(0x814cc20), ARRAY(0x819eae0)) p.e.@a = ([1,2,3],[a,b,c]);
Dumping the element to a file, and re-reading is the only way? ... or does it copy the references to a file, so when you load it, perl can allocate the elements on the same memory position? ...(ARRAY(0x814aaaa), ARRAY(0x819bbbb))
Thanks, :-)
turo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dump, Dup or Copy an object
by holli (Abbot) on Feb 22, 2006 at 13:13 UTC | |
|
Re: Dump, Dup or Copy an object
by borisz (Canon) on Feb 22, 2006 at 13:33 UTC | |
by turo (Friar) on Feb 22, 2006 at 15:06 UTC | |
by holli (Abbot) on Feb 22, 2006 at 15:30 UTC | |
by turo (Friar) on Feb 22, 2006 at 16:09 UTC | |
by holli (Abbot) on Feb 22, 2006 at 13:56 UTC | |
by borisz (Canon) on Feb 22, 2006 at 13:59 UTC | |
|
Re: Dump, Dup or Copy an object
by arkturuz (Curate) on Feb 22, 2006 at 13:23 UTC |