in reply to RegEx Perl Newbie Question
And there's always Text::CSV_XS:
c:\@Work\Perl>perl -wMstrict -le "use Text::CSV_XS; use Data::Dump; ;; my $s = 'foo~bar~\"disco~tab\"~quux'; print qq{'$s'}; ;; my $csv = Text::CSV_XS->new({ sep_char => '~' }) or die qq{Text::CSV_XS->new failed: }, Text::CSV_XS->error_diag; ;; $csv->parse($s) or die qq{parse failed: }, Text::CSV_XS->error_diag; my @fields = $csv->fields; dd \@fields; " 'foo~bar~"disco~tab"~quux' ["foo", "bar", "disco~tab", "quux"]
|
|---|