in reply to What is the most efficient way to split a long string (see body for details/constraints)?
Outputuse Modern::Perl; use Text::CSV_XS; use Data::Dumper; my $csv = Text::CSV_XS->new({ sep_char=> "," }); #normally this would be a real file handle my $line = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; open my $fh, "<", \$line; my $row = $csv->fragment($fh, "col=1;3;10-12;23-*"); print Dumper($row);
$VAR1 = [ [ 'a', 'c', 'j', 'k', 'l', 'x', 'y', 'z' ] ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What is the most efficient way to split a long string (see body for details/constraints)?
by Anonymous Monk on Jun 21, 2019 at 18:41 UTC |