in reply to Re: How to store multiples lines/records in a array
in thread How to store multiples lines/records in a array
Hi Monks,
Thanks for the replies, its working when the length of record is 5
code suggested by experts
# 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"
output displayed in table
ABC_TEK 12 DFE_YJK 24 JKL_GHY 26 HJK_YHJ 46 LKJ_UYH 29 GHK_YTH 23 GHS_JSF 34 GHJ_YJK 56 FHK_THE 25 SHJ_TRE 26 HSJ_TEH 39 SGH_YHK 66 AHJ_EGH 56 SGH_HEJ 42 HGE_THE 46 YHJ_JKL 44 HEJ_EJJ 67 JLE_EJK 89 EHJ_EJK 78 GSH_THK 43 EHJ_IKL 68 EHJ_EJK 57 EJH_EKL 69 HGJ_HJK 44
but if the size of the record increased from 5 to 6, i hope i need to change the logic from $i(0..6) and for (@values$i*7 .. ($i*7+6)), is thier any way where we can fetch each line based on line size
<code> for my $i(0..$#line) <code>please give suggestion on this
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to store multiples lines/records in a array (variable)
by Anonymous Monk on Jul 02, 2013 at 14:44 UTC | |
Re^3: How to store multiples lines/records in a array
by Anonymous Monk on Jul 02, 2013 at 14:47 UTC | |
Re^3: How to store multiples lines/records in a array
by NetWallah (Canon) on Jul 03, 2013 at 03:08 UTC |
In Section
Seekers of Perl Wisdom