#!/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"; } #### 1 => 12345 2 => Jim 3 => 4 => "Smith, Jr." 5 => 1234 W. Baker Ct. 6 => 7 => Ontario 8 => CA 9 => 12345 10 => 123456789 11 => 12 => 13 => 27-Apr-02 14 => 1234567