374|Mike who|kelticjan|mike@someemail.com|23/2/2012 10:57:32|0|0|Mike|Clements|90 Street Ave|Halifax|New Brunswick|1t5 7y7|516-555-5555|lol Transportation Inc.|a||a||||a,b,c,d,e,g,h,i,j,k||a|a|a|a|a,b,c,d,e|Idle time / miles per gallon|a,b,c||b||a,d,f,g,h| #### #!/usr/bin/perl use Text::CSV_XS; my $csv = Text::CSV_XS->new ({ quote_char => '"', escape_char => '"', sep_char => "|", eol => $\, always_quote => 0, quote_space => 1, quote_null => 1, quote_binary => 1, binary => 1, keep_meta_info => 0, allow_loose_quotes => 0, allow_loose_escapes => 0, allow_whitespace => 0, blank_is_undef => 0, empty_is_undef => 0, verbatim => 0, auto_diag => 0, }) or die "Cannot use CSV: ".Text::CSV_XS->error_diag (); open my $FH, "<:encoding(utf8)", "test.csv" or die "test.csv: $!"; while (my $line = $csv->getline ($FH)){ if ($csv->parse (@$line)) { my @field = $csv->fields; foreach my $col (0 .. $#field) { print $field[$col], "\n" ; } } else { print STDERR "parse () failed on argument: ", $csv->error_input, "\n"; $csv->error_diag (); } }