in reply to How to store multiples lines/records in a array
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):
And there is still room for improvement once you learn about "map" and "join" functions, as well as the Text::CSV and CGI modules.# 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"
"The trouble with the Internet is that it's replacing masturbation as a leisure activity."
-- Patrick Murray
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to store multiples lines/records in a array
by Perlseeker_1 (Acolyte) on Jul 02, 2013 at 14:35 UTC | |
by Anonymous Monk on Jul 02, 2013 at 14:44 UTC | |
by Anonymous Monk on Jul 02, 2013 at 14:47 UTC | |
by NetWallah (Canon) on Jul 03, 2013 at 03:08 UTC |