If you don't pass a reference, the array is flattened, and passed out as a simple list - not something you want in this case.Er, wha? This is a perfectly valid case to pass a list back and forth. Since the code is only dealing with a single array this is not an issue, it would be an issue however if multiple arrays were being passed about e.g
sub f { print "got: ", @_, $/ } my @a = qw( one two three ); my @b = qw( four five six ); ## @a & @b will be flattened into a single list f(@a, @b); ## pass references to keep array integrity f(\@a, \@b); ## only @a is passed, so only @a is received f(@a); __output__ got: onetwothreefourfivesix got: ARRAY(0x8107e50)ARRAY(0x8107f34) got: onetwothree
_________
broquaint
In reply to Re: Re: Passing Array of Arrays
by broquaint
in thread Passing Array of Arrays
by marctwo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |