in reply to Pass by ref an array weirdness

Your question has been answered but you have another issue that will eventually cause problems for you.

Your sub, "func" is defined with an empty prototype.

sub func() {
Later, you get around the problems caused by the prototype by calling the sub with an explicit &.

&func(\@x, \@y);

That's a terrible habit to get into. Prototypes in Perl aren't anything like prototypes in other languages and you shouldn't use them at all unless you really understand what they are for and can pick out the special case where they make sense. It would be better to define "func" as

sub func { ... }
and call it like
func(\@x, \@y);

-sauoq
"My two cents aren't worth a dime.";