i want to create something like a 2d array structure i've done the following will this work?
my $sth5 = $dbh->prepare("SELECT round, teamname, score from trees whe +re sport = ‘$sport’ and year = ‘$year’, ORDER BY round DESC") || die +"Can't prepare SQL get data statement"; $sth5->execute || die “can’t execute sql statement”; ##need to get all the data one row at a time from the table. my @row; $rowcount = 0; while (@row = $sth5->fetchrow_array) { $round = $row[0]; $teamname = $row[1];## need to put each row into list_ $Score = + $row[2];## of_lists a variable at a time push (@{list_of_teamdata[$rowcount]}, qw($round $teamname $score); $rowcount++; } This creates a list of structure round teamname score round teamname score round teamname score round teamname score etc i then need to substitute values from the list into the html document my $compsize = $#list2+1; If ($compSize = 7); Print “Content-Type: text/html\n\n”; Print “<html>\n” Print “<head>\n” Print “<title> tree7</title>\n” Print “</head>\n” Print “<body>\n” Print “<table border="1" width="100%">\n” Print “<tr>\n” Print “<td width="9%">&nbsp;</td>\n” Print “<td width="9%">&nbsp;</td>\n” Print “<td width="9%">&nbsp;</td>\n” Print “<td width="9%"><b>$list_of_teamdata [6][1]</b></td>\n” Print “<td width="9%"><b>$list_of_teamdata [6][2] </b></td>\n” is this correct. i realise this is not the best way but i'm very new +to perl and cgi programming.

In reply to Re: Re: Re: Re: appending an array to a hash by Anonymous Monk
in thread appending an array to a hash by Anonymous Monk

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.