in reply to How to slice complicated string into an array
Is that CSV? Then use Text::CSV / Text::CSV_XS.
use warnings; use strict; my $line = q{"word1",word2,"word3,word4"}; use Text::CSV; my $csv = Text::CSV->new({binary=>1,auto_diag=>2}); $csv->parse($line); use Data::Dumper; print Dumper( [ $csv->fields() ] ); __END__ $VAR1 = [ 'word1', 'word2', 'word3,word4' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to slice complicated string into an array
by theNeuron (Novice) on Feb 26, 2016 at 12:15 UTC | |
by poj (Abbot) on Feb 26, 2016 at 13:03 UTC | |
by Arunbear (Prior) on Feb 26, 2016 at 12:38 UTC |