bfish has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to use Text::Balanced to parse a string that uses single double quotes (e.g. ") to delimit and escapes a single double quote with double double quotes (e.g. ""). Here is the script I've written:
use Text::Balanced qw( extract_delimited ); use strict; my $line_in = q{""this"" "line" "has" "four"}; my $first_one; my $remainder; my $skipped; ($first_one, $remainder, $skipped) = extract_delimited($line_in, q{"}, '\s*', q{"}); print $first_one."\n"; print $remainder."\n";
And here is the output:
""
this"" "line" "has" "four"
The output I was hoping to get is:
"this"
"line" "has" "four"
What am I doing wrong?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Text::Balanced
by LTjake (Prior) on Aug 20, 2003 at 18:49 UTC | |
by bfish (Novice) on Aug 21, 2003 at 13:32 UTC | |
|
Re: Using Text::Balanced
by bear0053 (Hermit) on Aug 20, 2003 at 18:40 UTC |