[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] How to copy an structure



On Wed, 7 Jun 2000, Flavio Montiel wrote:

<snip multilevel structure>
> Is there an easy way to copy the
> whole structure (building a new structure with the same contents but not 
> using the old adresses)?
> 
> Maybe there's a module i couldn't find?

use Storable;

You can of course use it to store multilevel things like this to a file,
and retrieve, even on a different platform, but try these (from the POD):

 # Serializing to memory
 $serialized = freeze \%table;
 %table_clone = %{ thaw($serialized) };

 # Deep (recursive) cloning
 $cloneref = dclone($ref);


HTH.


--
MattLangford 


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org