in reply to Re: Preserve the value of original array
in thread Preserve the value of original array
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Preserve the value of original array
by McDarren (Abbot) on Feb 14, 2006 at 06:20 UTC |