Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Length of 2-dimensional array

by tedv (Pilgrim)
on Apr 06, 2001 at 00:50 UTC ( #70290=note: print w/replies, xml ) Need Help??

in reply to Re: Length of 2-dimensional array
in thread Length of 2-dimensional array

First, $#array is the index of the last element in the array. This is never the length of the array itself (unless you've mucked with $[, but don't do that). The best way to get the length of an array is to evaluate it in scalar context.

Second, they haven't defined what the "length" of the two dimensional array is, so it's very difficult to answer the question. Is "length" the length of the longest sub-array? The number of elements in the the main array? The total of all "end level" elements in the array? So maybe your definition of length is what he needs and maybe it isn't.

Incidently, Tye already illustrated the issues with the length concepts in another replay: each of the N different Sub-arrays could have different lengths from each other.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://70290]
[LanX]: fun, last time I was in Britain people had problems with my name, just rarely they said "like the children TV star Rolf Harris?", this time most replied instantly "Rolf? like the pedophile Rolf Harris" ?
LanX is perlophile
[ambrus]: Corion: read https://metacpan. org/pod/release/ MLEHMANN/AnyEvent- 7.13/lib/AnyEvent. pm#SUPPLYING-YOUR- OWN-EVENT-MODEL- INTERFACE in that case

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2016-12-08 12:01 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (140 votes). Check out past polls.