On Tue, Sep 24, 2002 at 11:14:04AM -0400, Aaron Sherman wrote:
> Again, we're wading into the waters of over-simplification. Let's try:
>
> sub foo1(){ my @foo=(1,2,3); return @foo; }
> sub foo2(){ my $foo = [1,2,3]; return $foo; }
> sub foo3(*@list) { print @list.length, "\n"; }
> @foo = (1,2,3);
> foo3(@foo, [1,2,3], foo2(), foo1());
>
> Ok, so what is the output? 12? 10? 8?
>
> More importantly, why? I could argue the case for each of the above
> numbers, but I think 12 is the way it would be right now.
Hrm. I think it must be 8. Since foo3() flattens it's parameters, we
get this:
foo3(1, 2, 3, [1,2,3], [1,2,3], 1, 2, 3);
and since the two [1,2,3] are scalar things, we have 8 scalar things
in our list. Splat doesn't "look inside" the thing it flattens AFAIK,
so it doesn't flatten the two [1,2,3].
-Scott
--
Jonathan Scott Duff
[EMAIL PROTECTED]