http://qs321.pair.com?node_id=11100500

klorentzen has asked for the wisdom of the Perl Monks concerning the following question:

If I create a multidimensional array using the following:

#!/usr/bin/perl my @ar1; $ar1[0][0] = "one"; $ar1[0][1] = "two"; $ar1[1][0] = "three"; $ar1[1][1] = "four"; $ar1[1][2] = "five"; my $count = scalar @{ $ar1[1] }; print "count = $count\n";

./ar1

count = 3

However, if I create the array this way it doesn't work: #!/usr/bin/perl my @ar1; $ar1 = (["one", "two"], ["three", "four", "five"]); my $count = scalar @{ $ar1[1] }; print "count = $count\n";

./ar1

count =

What is the correct way to access / count the array elements using the array creation method in the second code segment?

Thanks, ...Kurt