Found an interesting copying technique when you have a large data structure that contains code references. Use storable's dclone method: use Storable; # these lines are necessary for the code refernces to be copied; also it only works for certain versions. $Storable::Deparse = 1; $Storable::Eval = 1; %my::data:structure = %{Storable::dclone(\%your:data:structure)}; this allows me to replicate the two data structures. i encountered a problem where if i just tried to copy one hash to another like: %my:data::structure = %your::data::structure; that you would encounter a problem when dealing with references (not just code references). both are pointing to the same spot in memory, so your copy, if you want to localize it, won't work without a little aid.
Trackbacks: (Trackback URL)
