我遵循了两个用 perl 编写的语句:
@m1 = ( [1,2,3],[4,5,6],[7,8,9] ); # It is an array of references.
$mr = [ [1,2,3],[4,5,6],[7,8,9] ]; # It is an anonymous array. $mr holds reference.
当我尝试print
:
print "$m1[0][1]\n"; # this statement outputs: 2; that is expected.
print "$mr->[0][1]\n"; #this statement outputs: 2; that is expected.
print "$mr[0][1]\n"; #this statement doesn't output anything.
我觉得第二个和第三个打印语句是一样的。但是,第三个打印语句我没有任何输出。
谁能告诉我第三个打印语句有什么问题?