array 中的 array &hash

2013-09-11 18:35
[root@occas01 ~]# cat test.pl
my @d1 = (24.2, 26.3, 23.4);
my @d2 = (23.5, 27.5, 22.6);
my @d3 = (25.2, 28.7, 24.8);
 
my @daily = (\@d1, \@d2, \@d3);
 
print $daily[2][1];
 
[root@occas01 ~]# perl test.pl
28.7
 
my @array = ({3, 5, 7, 9}, [1, 4, 8, 6], {2, 5, 4, 2});

print $array[0][2];  # 得到的結果是7
print $array[1]{8};  # 這裡會印出6