my $arrayObjsRef = \@arrayOfObjects; my $copy = _deep_copy( $arrayObjsRef ); sub _deep_copy { my $this = shift; my $ref = ref $this; if ( not ref $this ) { $this; } elsif ( ref $this eq "ARRAY" ) { [ map _deep_copy( $_ ), @$this ]; } else { # this is where the objects would be copied +{ map { $_ => _deep_copy( $this->{$_} ) } keys %$this }; } }
In reply to deep_copy objects question by JAMBOID
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |