【发布时间】:2016-01-07 23:20:41
【问题描述】:
作为 Perl 的新手,我只是不明白以下结果背后的哲学是什么:
$cnt1 = @arr;
# this gives the length of the array 'arr'
$cnt2 = @arr[ @indices_arr ];
# this gives the last element of the @arr[ @indices_arr ];
有人能解释一下两者的区别吗?
【问题讨论】:
-
这两种结构都有用。两者都有记录。如果该语言缺少这两个特性之一,人们可能会问不实现其中一个特性的背后原理是什么。
标签: arrays perl list slice scalar