Hello, I was wondering if anyone could help me with something.
I am not a programmer yet I am able to modify scripts to a certain extent. I recently downloaded a script to read an existing CSV file and output via an SSI call. What I would like to do is to be able to read the third entry from the 2nd row, for example:
Bob;565 Apple Tree Lane;Vancouver;Canada
Fred;1234 Maple Road;Montreal;Canada
I would need to get/print the word "Montreal" (third entry from the second line, or any of my choice) from the existing CSV file and output using SSI, but not in a table, just as plain text with no carriage return, can you help?
Here is the CGI script (via SSI) I am presently using, yet it is printing the third entry from both lines. I need to extract/print the 3rd entry from the 2nd line only:
# <!--#exec cgi="my_ssi_file.cgi" -->
use CGI::Carp qw(fatalsToBrowser);
my $csvfile = "/home/public_html/cgi-bin/database/mycsvfile.csv";
print "Content-Type: text/html\n\n";
open (CSV, "< $csvfile");
my $cols = (split(/;/));