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


In reply to An array of arrays by Baz

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.