Okay, removing all of your class reference stuff, it looks like firstRow is not an array reference. Add this to your code, right after your first line in the new statement.
die "Ack! That's no reference. IT'S A MAN BABY\n" unless(ref $firstR +ow eq "ARRAY);
That will let you know if you're actually getting a reference to an array. Watered down, without the object stuff, this code works for me:
use strict; my @AoA; push @AoA, [1..40] for(1..20); print ref $AoA[0]."\n"; print "".(ref $AoA[0])."\n"; print $AoA[0][1]."\n"; Producing (correctly): ARRAY 2
This looks different than your code in a couple of places. First off (and apologies for the offtopic-ness, but it may simplify your code a bit), since you never use $row, you can simply your for statement to be:
for(1..$rows)
Ahh, a fellow C programmer ;). This is a range, and will be interpreted correctly by the for statement. Pushing the 1..40 or (1..$rows) in array context works fine for making 2d arrays.

Your best buddy here is ref. It will tell you whether you can make something into an array or not. For instance... if you
print ref $obj->{AoA};
...it will tell you whether you can use it as an ARRAY. Now if you
print ref $obj->{AoA}[$row];
...that will tell you that it's either a SCALAR or (more likely) not a reference (a blank string) in your previous trouble. This means that it can't be dereferenced as an array.

Hope that it's enough to get you started!

    --jb

In reply to Re: How does one by JayBonci
in thread How does one construct and access an array of arrays? by rbc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.