use YAML; my $complex_structure; { my $complex_structure = Load(Dump($complex_structure)); #Here, $complex_structure is independent .... } #Here, you come back to the first $complex_structure ....