On Tue, 2002-09-24 at 10:27, Peter Haworth wrote: > On 24 Sep 2002 05:21:37 -0400, Aaron Sherman wrote: > > On Tue, 2002-09-24 at 01:46, Trey Harris wrote: > > > sub push(@target is rw, *@list); > > > > Well, yes, but that wasn't the point. The C<*@list> will force array > > flattening, thus > > > > push @a, [1,2,3], 4; > > > > will (according to Larry's stated desire to unify arrays and references > > to arrays in terms of behavior) result in four elements getting pushed > > onto C<@a>, not two. > > But the decision on how arguments get passed happens at compile time, not run > time. At that point we can tell the difference between an explicit arrayref > and a flattened array:
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. -- Aaron Sherman <[EMAIL PROTECTED]>