[Brisbane-pm] Counting Elements in Multi-Dimensional Arrays

Martin Jacobs martin_jacobs at optusnet.com.au
Sun Mar 4 17:57:56 PST 2007


Folks,

Thanks to Dean and Damian for their replies to my earlier query.

I had not realized that multi-dimensional arrays in Perl were  
actually arrays of arrays (or lists of references to other lists?).  
Anyhow, your comments made sense, and I see why you have to loop  
through all the elements in order to count them.

Actually, what I wanted to do was to find the last timestep in a  
series of timesteps, and I was thinking of doing it indirectly by  
finding the length of the array and returning the value of that last  
element. As my program had already looped through the data, all I  
needed to do was to filch the last value from that loop.


Regards,
Martin
Visit my website...
http://web.mac.com/martin_jacobs1


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/brisbane-pm/attachments/20070305/68e3e58b/attachment.html 


More information about the Brisbane-pm mailing list