NewDTinStackoverflow
NewDTinStackoverflow

Reputation: 543

get the size of an array in an array in perl

@myArray is an array with one element. The element is an array with 20 elements.

@myArray->
        [0]-> 
             [0]
              .
              .
              .
              [19]

How do I get to the size (20) of the array inside the array?

Upvotes: 2

Views: 95

Answers (1)

toolic
toolic

Reputation: 62236

Dereference the array:

use warnings;
use strict;

my @arr = [5..24];
print scalar @{ $arr[0] }, "\n";

Output:

20

Upvotes: 4

Related Questions