in reply to
Deep Copying of Nested Data-Structures
personally, i like the following, nicked shamelessly
from the font of merlyn. nice esp. if you do not want
the overhead of another module.
sub deepcopy{
my $this = shift;
if (not ref $this){
$this;
}
elsif (ref $this eq "ARRAY") {
[map deepcopy($_), @$this];
}
elsif (ref $this eq "HASH"){
scalar { map { $_ => deepcopy($this->{$_}) } keys %$this };
}
else { die "what type is $_?"}
}
hope that helps,
wufnik
-- in the world of the mules there are no rules --