Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: Re: Finding the length of an array of arrays

by Boogman (Scribe)
on Aug 17, 2000 at 23:43 UTC ( [id://28362]=note: print w/replies, xml ) Need Help??


in reply to Re: Finding the length of an array of arrays
in thread Finding the length of an array of arrays

Shouldn't that be print scalar( @$array[$i][$k] ); or print $#$array[$i][$k]; to print the size out. Otherwise your printing the reference to the array, I think.

Update: oops, sorry. You're right...

Got confused with the "length of array in array of arrays". Thought that meant the array of arrays held references to arrays again...

Replies are listed 'Best First'.
RE: RE: Re: Finding the length of an array of arrays
by btrott (Parson) on Aug 17, 2000 at 23:45 UTC
    That print line isn't printing the size; I didn't think that was what the OP wanted, from the code he/she demonstrated. It looked like he/she just wanted to find the "length" of the array (actually the last index) in order to loop over the inner arrays, then print out each element. So that's what my code does: the print line is printing the element with index $k in the array at $i in the original array @array.
      You are correct, and the changes you suggested worked perfectly. Thanks.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://28362]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found