Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
how to read and display from csv file using perl

Posted by kirankumargt (kirankumargt), 20 March 2007
Hi friends,

           i am beginner to the perl ,in my project i want to read the data from csv file, so please help me if any body knows this.................

Posted by admin (Graham Ellis), 20 March 2007
Will a split function help?

Posted by kirankumargt (kirankumargt), 21 March 2007
sorry to say this, i dont know that split function will work or not....

i got how to read from that file but while displaying it is displaying all fields continuously, i want line by line display can u please tell me that how i can display that.......

Posted by admin (Graham Ellis), 21 March 2007
If you can paste up a few lines of code to show us what you mean, we might be able to help.

Posted by kirankumargt (kirankumargt), 21 March 2007
Colavo      jaison-san      january      1      1      lhk      hhk      kl      kh      kl      khl      Fri Mar 16 11:40:17 2007
Colavo      jaison-san      january      1      1      yu      ytue      etu      tyeu      tyeu      ytu      Fri Mar 16 11:41:30 2007
Colavo      jaison-san      january      1      1      e      re      er      re      re      re      Fri Mar 16 11:46:29 2007
Colavo      jaison-san      january      1      1      f      f      f      ff      f      f      Fri Mar 16 11:47:03 2007

like this i want line by line display.......if i have book1.csv  like one csv file (comma delimiter) in that data is stored one line in one row and each word in line are stored in separate column  above shown way.....
while retrying from html page i want to display line by line as i shown, but i am getting continuously so please help  me


&parse_form_data (*simple_form);

my $mail_to     =  '' ;
my $server      =  '';
my $mail_from   =  $emailid;
use Mail::Sendmail;
$receive = "true";
$sproject_members = $simple_form{'projectmembers'};
#$sname = $simple_form{'name'};
$fromdate = $simple_form{'fromdate'};
$todate = $simple_form{'todate'};
#$status = $simple_form{'status'};
$work_mon = $simple_form{'monday'};
$work_tue = $simple_form{'tuesday'};
$work_wed = $simple_form{'wednesday'};
$work_thu = $simple_form{'thursday'};
$work_fri = $simple_form{'friday'};
$workplaned = $simple_form{'workplaned'};
$choosing_report=$simple_form {'choosingreport'};
if($receive eq "true")
 if($choosing_report eq "false")      {
  || die "cannot open file";
  #print FILE "\n"."$sproject_members";
     print FILE "\n"."$project_name".","."$sproject_members".","."$month".","."$fromdate".","."$todate".","."$work_mon".","."$work_tue".","."$work_wed".","."$work_thu".","."$work_fri".","."$workplaned".","."$submitiondateandtime".","."$emailid";
     else      {
  ||die "cannot open file";
     print FILE1 "\n"."$project_name".","."$sproject_members".","."$month".","."$fromdate".","."$todate".","."$day_report".","."$workplaned".","."$submitiondateandtime".","."$emailid";
print "Content-Type: text/html\n\n";
print "<html> <head>\n";
print "<title>Minimal Input</title>\n";
print "</head>\n";
print "<body>\n";
print "<br>Inserting report successfuly\n\n";
print "\n\n</body> </html>\n";

print "Content-Type: text/html\n\n";
print "<html> <head>\n";
print "<title>Minimal Input</title>\n";
print "</head>\n";
print "<body>\n";
print "<br>Inserting report failed";
print "</body> </html>\n";
print "\n";
  || die "NO SUCH Directory: Images";
while ($file ne "" )
#if ($file =~ $delimeter)
 #      {
               #print("........................\n"); /\s*\b    \b\s*/
                    print (@wrds[0]);
                    print (@wrds[1]);
                       print (@wrds[2]);
                       print (@wrds[3]);
                       print (@wrds[4]);



Posted by admin (Graham Ellis), 21 March 2007
Should you be generating a <br> rather than a \n?    \n will give you a new line if you view source, but on a browser it will just give you a space.

Posted by kirankumargt (kirankumargt), 22 March 2007
Thanks  GRAHAM  for u'r well suggestion ............

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho