local function deepcopy(input)
local t=type(input)
if t~="table" then
return input
end
local copy={}
for k,v in pairs(input) do
k=deepcopy(k)
v=deepcopy(v)
copy[k]=v
end
return copy
end
local y=deepcopy(x)
uses classes;
y.assign(x);
use Storable qw(dclone);
my @y = @x; # for simple arrays
# for complex arrays with references:
my @y = @{dclone(\@x)};
local function deepcopy(input)
local t=type(input)
if t~="table" then
return input
end
local copy={}
for k,v in pairs(input) do
k=deepcopy(k)
v=deepcopy(v)
copy[k]=v
end
return copy
end
local y=deepcopy(x)