in reply to ref array being modified unexpectively
The behavior you observe is to be expected, if one is sufficiently familiar with Perl 5.
In particular none of the steps cause a copy of the array (hey, you're passing a reference after all!).
Perhaps the most surprising point is that foreach my $item alises $item to the current list/array element. But again that's "works as designed".
|
|---|