于 2013-1-8 9:33, Neo Anderson 写道:
> I think there are two ways to declare an array:
> my @a1 = (1, 2, 3);my @a2 = [1, 2, 3];
> What is the difference?

The first is an array.
The second is a reference to the array.
And you should define the second with:
my $a2 = [1,2,3];
$a2 is a scalar not an array now.

HTH.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to