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".
In reply to Re: ref array being modified unexpectively
by moritz
in thread ref array being modified unexpectively
by duyet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |