Create the new object y by cloning the all the contents of x, recursively.
import copy
y = copy.deepcopy(x)
let y = structuredClone(x);
classes
var x,y: TPersistent; ... y.assign(x); ...
use v5.7.3; use Storable qw(dclone);
my $x = [ 1, 2, [ 'a' ], { x => [3,4] } ]; my $y = dclone $x;
y = Marshal.load(Marshal.dump(x))
No security, no password. Other people might choose the same nickname.