laziness, impatience, and hubris | |
PerlMonks |
Re: how to use two dimensional array?by muba (Priest) |
on Jun 14, 2013 at 05:57 UTC ( [id://1038893]=note: print w/replies, xml ) | Need Help?? |
hi sankar R, welcome to Perlmonks! You might want to check the markup of your post, and throw in a few <code>...</code> tags to make it more readable. As to answer your question: 1. If you want to access an element in a two-dimensional array, you'll need two indexes (one for each dimension). For an array to be two-dimensional, it just means that it is an array where each element is also an array (or more correctly, an array reference). If you just want to get the inner array without caring that it is an array, then you could do it with a single index. 2. I infer that you mean that you have an array with 10 elements, each containing an array of 2 elements. Is this correct? 3. Ok, that's clear. You want to access the elements of the inner arrays one by one. 4. Well... How does this fail you?
Output:
5. I think I did that in point 4. :) Cheers.
In Section
Seekers of Perl Wisdom
|
|