[Melbourne-pm] 3 dimensional array inner loop sizes

Sam Watkins swatkins at fastmail.fm
Mon Jan 26 12:27:40 PST 2009


hi Tim,

$ perl -e '$data[0][0][15]++; print $#{$data[0][0]}'
15

hope that helps!

Sam

On Mon, 26 Jan 2009 11:54 +0000, "Tim Hogard" <thogard at abnormal.com>
wrote:
> I have a bit of a problem I can't work out. 
> 
> I have a process that goes through a bunch of text files and counts up
> a bunch of stats and sticks them in a 3 dimensional array:
> 
> 	$data[$category][$row][$col]++;
> 
...
> What is the proper syntax to find out $max_row for $data[category]
> and how do I find out $max_col for $data[category][$max_row]?
> I tried things like $#data[$category] but that doesn't work.
> 
> I'm using perl 5.8.8 and 5.10.
> 
> Thanks,
> 
> -tim


More information about the Melbourne-pm mailing list