Baz has asked for the wisdom of the Perl Monks concerning the following question:

I have a form which is produced by the code below. The WHILE loop is filling the table with data from a SQL table, and continues to poll for each entry(row) in the database table.
my @tableCont; while(***) { push(@tableCont,td(***).td(***)); } print startform(***), table(Tr(/@tableTop),Tr(/@tableCont)), submit(***),end_form);
I now want to break my table into a number of smaller tables something similar to the following...
print startform(***), table(Tr(/@tableTop),Tr(/@tableCont_1)), table(Tr(/@tableTop),Tr(/@tableCont_2)), table(Tr(/@tableTop),Tr(/@tableCont_3)), submit(***),end_form);
So now, for example, lets say there are 30 entries(rows) in my SQL table, the WHILE loop will, for this case, exectute 30 times. And lets say i want to create 3 different tables based on this data, i.e. Table 1 = row 0 ..9 Table 2 = row 10..19 and Table 3 = 20..29. OR Table[i%10] = row(i), where i is the ith iteration of the while loop.
How can i right my code so that i have 3 different arrays, array 1 being pushed for rows 0 to 9. I read somewhere that perl does not allow an array of arrays. If it di i could do something like this(perhaps)
while($i<30) { $i++ push(@tableCont[i%10],td(***).td(***)); }
My 3 tables acould then be constructed as /@tableCont[0],/@tableCont[1] and /@tableCont[2]

Edited 2001-12-13 by Ovid

Replies are listed 'Best First'.
(shockme) Re: An array of arrays
by shockme (Chaplain) on Dec 14, 2001 at 00:10 UTC
    perlLoL and this thread discuss much of what you're attempting to do.

    Hope this proves helpful.

    If things get any worse, I'll have to ask you to stop helping me.

Re: An array of arrays
by r3b3lxd (Initiate) on Dec 20, 2001 at 20:30 UTC
    It is possible to make an array of array references like so:
    @array = ( \@array1, \@array2);
    Or you could use anonomous arrays (no name):
    @array = ( [ "value1", "value2" ], [ "foo", "bar" ] );
    Rob
Re: An array of arrays
by andye (Curate) on Dec 14, 2001 at 20:06 UTC