in reply to split $data, $unquoted_value;

You already have a split that does what you're describing in your update.
@data = split /($RE{quoted})|\./;
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 = grep length, 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:
my $accum; @data = map { if ($length) { $accum .= $_; () } else { my $x = $accum; $accum = ''; $x } } split /($RE{quoted})|\./; push @data, $accum;
Caveat: I can't test code today.

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: split $data, $unquoted_value;
by Ovid (Cardinal) on Sep 14, 2005 at 22:12 UTC

    I also need to capture the split value (in this case, just a period). However, you did remind me of that useful feature of split returning items in capturing parens. If my theoretical Data::Record module comes to light, I can use that to control the chomp-like behavior.

    Cheers,
    Ovid

    New address of my CGI Course.

Re^2: split $data, $unquoted_value;
by duelafn (Parson) on Sep 15, 2005 at 16:15 UTC

    Great idea, this works.

    #!/usr/bin/perl use strict; use warnings; use Regexp::Common qw/delimited number/; use YAML; my $x = 'Foo "ba . r". Baz. $2.67 per pound. is a "." in a sentence re +ally a "."?'; my @x = split /($RE{delimited}{-delim=>'"'}|$RE{num}{real}|\.)/, $x; my @y = (''); for (@x) { $y[-1] .= $_; push @y, '' if $_ eq '.'; } pop @y if $y[-1] eq ''; print Dump \@y;

    Good Day,
        Dean