in reply to split $data, $unquoted_value;
By putting the "unless" portion in capturing parens, they are captured and included with the results. I think that when a dot is encountered, it will generate an empty data item, so you might want to grep out empty results.@data = split /($RE{quoted})|\./;
Update: Gah, that's not the same thing. You really need to do two passes: split as above, then join anything that isn't separated by an empty string element. Something like:@data = grep length, split /($RE{quoted})|\./;
Caveat: I can't test code today.my $accum; @data = map { if ($length) { $accum .= $_; () } else { my $x = $accum; $accum = ''; $x } } split /($RE{quoted})|\./; push @data, $accum;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split $data, $unquoted_value;
by Ovid (Cardinal) on Sep 14, 2005 at 22:12 UTC | |
|
Re^2: split $data, $unquoted_value;
by duelafn (Parson) on Sep 15, 2005 at 16:15 UTC |