#!/usr/bin/perl -w use Text::CSV_XS; my $csv = Text::CSV_XS->new; my $column = ''; my $sample_input_string = '12345,Jim,,"""Smith, Jr.""",1234 W. Baker Ct., ,Ontario,CA,12345,123456789, ,,27-Apr-02,1234567 '; if ($csv->parse($sample_input_string)) { my @field = $csv->fields; my $count = 0; for $column (@field) { print ++$count, " => ", $column, "\n"; } print "\n"; } else { my $err = $csv->error_input; print "parse() failed on argument: ", $err, "\n"; }