[英]Size of 2D array in Perl
I need to get the size of the second level in a 2D array. 我需要在2D数组中获得第二级的大小。 I'm trying this:
我正在尝试这个:
my @txt;
$txt[0][0]="text1";
$txt[0][1]="text2";
$txt[0][2]="text3";
$txt[1][0]="text4";
$txt[1][1]="text5";
$txt[1][2]="text6";
print scalar(@txt[1]);
But it doesn't work, and I see "ARRAY(0x804daf0)". 但它不起作用,我看到“ARRAY(0x804daf0)”。 How to get the size of the second dimension?
如何获得第二维的大小?
print scalar @{ $txt[1] };
should do the trick... 应该做的诀窍......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.