in reply to Re: variable declaration question
in thread variable declaration question

print(my $foo = (1, 2, 3), "\n"); print(my ($foo) = (1, 2, 3), "\n"); __END__ 3 1

Ah, I see. The line:

print(my $foo = (1, 2, 3), "\n");

is a convenient way of assigning the last element of an array to a variable.

Replies are listed 'Best First'.
Re^3: variable declaration question
by keszler (Priest) on Jan 18, 2013 at 22:14 UTC
    Try:
    print(my $foo = ('a', 'b', 'c'), "\n");
    vs:
    my @foo = ('a', 'b', 'c'); my $bar = @foo; print $bar, "\n";
    I like using letters vs numbers to avoid confusion...

      Quite right. ++

      --MidLifeXis