I need to copy the array into an array, and not make a copy of the reference, as in:
Am I right?sub second { my $num_ref = shift; my $copy_of_ref = $num_ref; push(@$copy_of_ref, 6); my $sum = 0; foreach (@$copy_of_ref) { $sum += $_; } return $sum; }
In reply to Re^2: Preserve the value of original array
by Anonymous Monk
in thread Preserve the value of original array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |