Here is that same code rewritten to produce your desired output. you went a little nuts adding in () where they were not needed. I changed the first line of thing so that it users shift, this makes it clear its grabbing the first value passed to the sub. Your way worked but it was less clear in my opinion. Then the rest of thing is the same except you use $REF_array-> in place of @ARRAY and drop the () around the values on the right. I'm not sure what there purpose was there but the code runs without them. Without further ado....
use warnings; thing(\@FooBar); for (@{$FooBar[0]}) { print "$_\n"; } for (@{$FooBar[1]}) { print "$_\n"; } sub thing { $REF_array = shift; $REF_array->[0] = ["some","values"]; $REF_array->[1] = ["some","more","values"]; }
In reply to Re: I've read perlref
by eric256
in thread I've read perlref
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |