sub foo { my $array = shift; my $copy = [map {[@$_]} @$array]; ... Changes in $copy won't affect $array ... return $copy; }