Here is my code that uses Text::CSV::Simple; the goal was to parse a NYSE price list from the Wall Street Journal.
use strict;
use Text::CSV::Simple;
#usage wsj2csv AMEX091806.txt
my ($filename) = shift;
print $filename."\n";
print "What is the trading date(MMDDYY)?";
my $traddt = <STDIN>;
print $traddt."\n";
my $parser = Text::CSV::Simple->new;
$parser->want_fields(1, 2, 3, 4, 5, 6, 8);
my @data = $parser->read_file($filename);
my $datalines = @data;
print $datalines."is number of rows.\n";
for my $row(@data) {
my @line = @$row;
foreach my $row1(@line) {
print $row1.",";
}
print "\n";
}
I intend to add more functionality to this; but this thread was helpful to me in getting the parser to work