On 23 Sep 2002, Simon Cozens wrote:

> [EMAIL PROTECTED] (Luke Palmer) writes:
> > Since we now have an explicit flattening operator (unary *), there's no 
> > need to differentiate between a "real" list and a reference to one.
> 
> What context does "push" impute on its operands?
> 
> If
>      push @a, [1,2,3,4];
> and
>      push @a, 1,2,3,4;
> are going to be the same, you'll have real problems. I don't fancy doing
>      push @a, [[1,2,3,4]];
> 
> And if you get around that by special-casing push to take an list of scalar
> contexts, then, well, urgh.


Aha!  Kudos, Simon, this (alongside Aaron's message) was a stumper.  But I 
think I've got it!

        push @a: [1,2,3,4];

pushes an array ref onto @a.

        push @a: *[1,2,3,4];

pushes 1, 2, 3, and 4 onto @a (as it would without the * and []).

        [$a, $b] = [$b, $a];

is a syntax error (assignment to non-lvalue).

        [$a, $b] ^= [$b, $a];

Assigns $a to $b and $b to $a.  C<my> would return a list of its 
declarees, so:

        my($a, $b) ^= [1, 2];

would work.  Finally,

        [1,2,3][1] == 2

means

        [1,2,3].[1] == 2

which is fine.

Luke

Reply via email to