Hello pagarwal, please read Welcome to the Monastery! Make yourself at home. and Before You Post ..., to be sure to gets some answers.
In your 3 post's you did, you didn't use <code> tags, posted an empty question, and placed it a second time using a different title
Basically think before post i's suggest, and read the tutorials and use supersearch before asking these basic questions. | [reply] |
$#array_name can be used to find the length of an array, @array_name, but I'm not entirely sure how you're going to be getting at the array so I can't really be more helpful than that
Update: As Taulmarill rightly points out this isn't strictly the length of the array, but the index of the last element, which is normally one less than the length of the array since they are zero-indexed (ie the first element of the array has index 0, not 1 as you might expect), but you might find this useful as well :) | [reply] |
this is not realy true. you get the number of elements of an array by setting the array in scalar context. $#array gives you the the position of the last array element, which is mostly not the same.
to get the size of a nested array, you have to understand references and how perl handles lists of lists. for the lazy, here is an example.
print scalar @{$foo{key1}->[0]}, "\n";
for those who want to know whats going on, start by reading perlreftut, perldsc and perllol.
| [reply] [d/l] |
scalar @{$hash{'Array11'}};
Caution: Contents may have been coded under pressure.
| [reply] [d/l] |
0 + @{$hash {Array1} [1]}
That is, if you mean you want the length of the array that's the second element of the array on index 'Array1' of the hash.
But your notation is clumsy and unformatted, so you might want something completely different. | [reply] [d/l] |