To get the output you want from the input you listed, you probably don't
want to use split(). Take a look at the m// construct.
use strict; #Always use strict and warnings
use warnings;
my @val; #declare myself an array.
while (<DATA>) { # DATA is a special file handle that reads from the
# END of the program text
@val = m/".*?",?/g; # m//g in list context returns all matches
# list gets all matches of things that begin with a double quote
# followed by any character zero or more times matching the
# minimal amount before finding a double quote followed by zero
# or more commas.
}
print "<<$_>>" for @val;
print "\n";
__END__
"a", "bcd, efg, h", "c"
perldoc perlre has more.
Peter C.
-----Original Message-----
I have a text files to analyze. Each line looks like : "a", "bcd, efg, h",
"c"
I found that $l=readline($filehandle) gives me the content of the current
line.
Now, how can I explode the line. I'd like:
$val[0]="a", $val[1]="bcd, efg, h", $val[2]="c" (or equivalent).
I cannot figure out how to use split when the delimiter is the double quote.
Thanks for your help.
Jean-Louis
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]