Simpler parsing of CSV files
Version: 1.00Text::CSV::Simple is a Perl module to simplify parsing of CSV files.
License: Perl Artistic License
Operating System: Linux
Homepage: search.cpan.org
Developed by:
SYNOPSIS
my $parser = Text::CSV::Simple->new;
my @data = $parser->read_file($datafile);
print @$_ foreach @data;
# Only want certain fields?
my $parser = Text::CSV::Simple->new;
$parser->want_fields(1, 2, 4, 8);
my @data = $parser->read_file($datafile);
# Map the fields to a hash?
my $parser = Text::CSV::Simple->new;
$parser->field_map(qw/id name null town/);
my @data = $parser->read_file($datafile);
Parsing CSV files is nasty. It seems so simple, but it usually isn't. Thankfully Text::CSV_XS takes care of most of that nastiness for us.
Like many modules which have to deal with all manner of nastiness and edge cases, however, it can be clumsy to work with in the simple case.
Thus this module.
We simply provide a little wrapper around Text::CSV_XS to streamline the common case scenario. (Or at least my common case scenario; feel free to write your own wrapper if this one doesn't do what you want).