http://www.perlmonks.org?node_id=1041305


in reply to How to store multiples lines/records in a array

In addition to what others have said, did you really intend to index the arrays starting at 1 ? Perl arrays start at 0. You seem to want to print 6 itemes per row, and starting at a "1" index will leave unprinted items.

Also, perl loops are usually written in a way that avoids indexing. Your loops could be written (assuming you want a 0-based index, and want to print the complete input data, and you correct the input 'split' delimiter):

# HTML ignores the "\n", but it looks nicer in 'print'; $table="<table>\n"; for my $i(0..5) { $table .= "<tr>"; for (@values[$i*6 .. ($i*6+5)]) { # 'Array Slice' $table .= "<td>$_</td>"; } $table .= "</tr>\n"; } $table .= "</table>\n"
And there is still room for improvement once you learn about "map" and "join" functions, as well as the Text::CSV and CGI modules.

             "The trouble with the Internet is that it's replacing masturbation as a leisure activity."
        -- Patrick Murray