I think I have misunderstood some aspects of argument passing to functions in Perl. What\'s the difference between func(\\@array) and func(@array)?
func(\@array) passes a reference. func(@array) passes a list (of the elements in @array). As Keith pointed out, these elements are passed by reference. However, you can make a copy inside the sub in order to pass by value.
What you are after is this:
sub func {
my @array = @_;
}
This will pass a copy of the arguments of func to @array, which is a local variable within the scope of the subroutine.
Documentation here