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,
I am reading records from the file and assigning the each record to array using the below code and trying to print each field in table
data{ my @values; my $table; my $Filename; open (F, "$Filename") || die ("Could not open $Filename!"); while (my $line = <F>) { chomp($line); push (@values,split(',', $line));} close (F); $table .= "<table border=1>"; for (my $i=1;$i<4;$i++) { $table .= "<tr>"; for (my $j=1;$j<7;$j++) { $table .= "<td>$values[$j]</td>";} $table .= "</tr>";} $table .= "</table>";} } my $table = Data(); Email( $table); sub Email { my ( $table) = @_; my $lEmailAddress = 'hem_k24@gmail.com'; my $env = "- $ENV_NAME"; my $msg = MIME::Lite->new( From => $lEmailAddress, To => $lEmailAddress, Cc => $lEmailAddress, Subject => "Test", Type => 'multipart/mixed', ); $msg->attach( Type => 'TEXT/HTML', Data => $table, ); $msg->send; } <p>This is my input</p> <code> ABC_TEK,12,DFE_YJK,24,JKL_GHY,26,LKJ_UYH,29,GHK_YTH,23,GHS_JSF,34, FHK_THE,25,SHJ_TRE,26,HSJ_TEH,39,AHJ_EGH,56,SGH_HEJ,42,HGE_THE,46, HEJ_EJJ,67,JLE_EJK,89,EHJ_EJK,78,EHJ_IKL,68,EHJ_EJK,57,EJH_EKL,69,
gives me this output message / faulty output: in table
ABC_TEK 12 DFE_YJK 24 JKL_GHY 26 LKJ_UYH 29 GHK_YTH 23 GHS_JSF 34 FHK_ +THE 25 SHJ_TRE 26 HSJ_TEH 39 AHJ_EGH 56 SGH_HEJ 42 HGE_THE 46 HEJ_EJJ + 67 JLE_EJK 89 EHJ_EJK 78 EHJ_IKL 68 EHJ_EJK 57 EJH_EKL 69
I'm trying to print the fields in table
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How to store multiples lines/records in a array
by ww (Archbishop) on Jun 29, 2013 at 01:53 UTC |
In Section
Seekers of Perl Wisdom