in reply to Re: Passing Array of Arrays
in thread Passing Array of Arrays
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Passing Array of Arrays
by Tanalis (Curate) on Mar 11, 2003 at 13:26 UTC | |
by broquaint (Abbot) on Mar 11, 2003 at 13:57 UTC | |
by zigdon (Deacon) on Mar 11, 2003 at 13:53 UTC |