The code above protects your original data against changes in the called subroutine by allocating new anonymous arrays, filling them with the data from the original arrays, and only passing references to the new anonymous arrays to the subroutine. In general, that's a good thing.
But it doubles the memory requirement for the arrays so it may not be an option if the arrays are large.
--
David Serrano
In reply to Re^2: How to pass two arrays to a sub?
by Hue-Bond
in thread How to pass two arrays to a sub?
by sanjay nayak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |