goude
06-11-2009, 10:44 AM
Hello everyone,
I have a 2D matrix with size 20x8 (20 rows & 8 columns) and I'm trying to print each element to an HTML table. The easiest way to do that is to print each line separately:
1st Row
print "<TR> <TH>row1</TH> <TH>$data[0][0]</TH> <TH>$data[0][1]</TH> <TH>$data[0[2]</TH> <TH>$data[0][3]</TH> <TH>$data[0][4]</TH> <TH>$data[0][5]</TH> <TH>$data[0][6]</TH> </TR>";
2nd Row
print "<TR> <TH>row2</TH> <TH>$data[1][0]</TH> <TH>$data[1][1]</TH> <TH>$data[1]2]</TH> <TH>$data[1][3]</TH> <TH>$data[1][4]</TH> <TH>$data[1][5]</TH> <TH>$data[1][6]</TH> </TR>";
It works fine like that but is there a way to simplify things? I mean there must be a better way to do that instead of writing 20 print statements.
Does anyone know a better way of doing this? Any suggestions. please?
Thanks
I have a 2D matrix with size 20x8 (20 rows & 8 columns) and I'm trying to print each element to an HTML table. The easiest way to do that is to print each line separately:
1st Row
print "<TR> <TH>row1</TH> <TH>$data[0][0]</TH> <TH>$data[0][1]</TH> <TH>$data[0[2]</TH> <TH>$data[0][3]</TH> <TH>$data[0][4]</TH> <TH>$data[0][5]</TH> <TH>$data[0][6]</TH> </TR>";
2nd Row
print "<TR> <TH>row2</TH> <TH>$data[1][0]</TH> <TH>$data[1][1]</TH> <TH>$data[1]2]</TH> <TH>$data[1][3]</TH> <TH>$data[1][4]</TH> <TH>$data[1][5]</TH> <TH>$data[1][6]</TH> </TR>";
It works fine like that but is there a way to simplify things? I mean there must be a better way to do that instead of writing 20 print statements.
Does anyone know a better way of doing this? Any suggestions. please?
Thanks