in reply to Efficient solution needed for this program
$!/usr/bin/perl use strict; use warnings; use Text::CSV_XS; my $file = $ARGV[0] or die "Usage: $0 <input_file>"; open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $ +!"; my $csv = Text::CSV_XS->new; while (<$fh>) { chomp; if ($csv->parse($_)) { printf "'%s'\t'=>\t'%s'\n", $csv->fields; } else { print STDERR "parse() failed for '$_': ", $csv->error_input; exit; } }
Cheers - L~R
|
|---|