> > CKC> I don't understand the question. What while loop? > CKC> What would it be looping over? > > I want print all items into table, table should have 3 columns. > I don't know how to do it. > > Thanks and sorry for not clear question before. > > --
Do you mean you want a loop for rolling over all the contents in your array ? Try this : my @file = ('123', '333', 'abc', '13123', 'ccc', 'ddd', 'eee', 'fff', 'ggg'); my $WantColsByRow = 3; # Change this for how many cols you want to have within a row my $onCol = 0; print "<table border=1>\n<tr>"; foreach my $data (@file) { if ($onCol == $WantColsByRow) { print "</tr>\n<tr>" ; $onCol = 0 } ; print "<td>$data</td>"; $onCol ++ } print "</tr>\n</table>" you got : <table border=1> <tr><td>123</td><td>333</td><td>abc</td></tr> <tr><td>13123</td><td>ccc</td><td>ddd</td></tr> <tr><td>eee</td><td>fff</td><td>ggg</td></tr> </table> CGI is good, but sometimes, that's better to choose a convinence way , rather than a standard way. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>