On 8/1/05, Ingo Blechschmidt <[EMAIL PROTECTED]> wrote:
> In general, (@foo, @bar) returns a new list with the element joined,
> i.e. "@foo.concat(@bar)". If you want to create a list with two sublists,
> you've to use ([EMAIL PROTECTED], [EMAIL PROTECTED]) or ([EMAIL PROTECTED], 
> [EMAIL PROTECTED]). But of course, I could
> be totally wrong. :)

I think that's right.  However, it might be a good idea not to
auto-enreference such bare lists:

    sub foo ($x) {...}
    foo (1,2,3,4,5);   # foo gets called with [1,2,3,4,5]

When you could just as easily have said:

    foo [1,2,3,4,5];

And we'll probably catch a lot of Perl 5 switchers that way.  That
actually makes a lot of sense to me.  The statement:

    my $x = (1,2,3,4,5);

Looks like an error more than anything else.  That's the "scalar
comma", which has been specified to return a list.  But maybe it
should be an error.  The main reason that we've kept a scalar comma is
for:

    loop (my $x = 0, my $y = 0; $x*$y <= 16; $x++, $y++)
    {...}

However, I think we can afford to hack around that.  Make the first
and last arguments to loop take lists and just throw them away.  Can
anyone think of any other common uses of the scalar comma?

Luke

Reply via email to