Aldo Calpini skribis 2005-03-09 12:12 (+0100):
>   my @a = 1,2,3;
>   my $a = 1,2,3;

These are

    (my @a = 1), 2, 3;
    (my $a = 1), 2, 3;

if I understand precedence correctly. (S03)

>   my $a = [EMAIL PROTECTED];
>   my $a = *(1,2,3); # or is this a syntax error?
>   my $a = *(list 1,2,3);
>   my $a = *[1,2,3];

I hope this will emit some kind of too-many-arguments warning in
addition to assigning 1 to $a.

> and I have absolutely no clue about the following:
>   my *$a = @a;
>   my *$a = (1,2,3);

1, I hope. I think the * provides list context to the RHS as * in a
sub signature does to the arguments.

1 would be consistent with

    my ($a) = @a;

in Perl 5

>   my *$a = [1,2,3];

Arrayref.

(I don't like @a = []. It makes @a = ([]) be counter-intuitive (parens
only group for precedence), and @a = [[]] feels VERY weird. Besides
that, it makes @a = $b completely unpredictible if the type of $b is
unknown. If it's an arrayref, @a gets all its elements, but if it's a
normal value, @a gets only one element. That's a problem for general
purpose modules/subs. I guess they could all use @a = [$b], but I find
that ugly.)


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to