in reply to Re: Splitting strings with enclosed delimiters
in thread Splitting strings with enclosed delimiters
use strict; my $line; while ($line = <DATA>) { chomp $line; print $line,"\n"; while ($line =~ m/\G(?:([^" ]+)|"([^"]+)")(?: |$)/g) { print ">>>",$1||$2,"\n"; print $line,"\n"; }; }; __DATA__ "72 3267S" "S2079" 1 no "72 0250" "S3011" 1 no "72 8351S" "S6101" 1 no "72 17082S" "S6108" 1 no
-- Randal L. Schwartz, Perl hacker
|
|---|