in reply to split question

This will do what you want:
my $string = '"Foo, Bar", "", "Blah"'; my @elements = $string =~ /"(.*?)"/g;

Replies are listed 'Best First'.
Re^2: split question
by johngg (Canon) on May 29, 2008 at 23:06 UTC
    Another way to do this would be to use a regex that avoids non-greedy matching by employing a negated character class, ie "([^"]*)" captures zero or more non-double quotes that are surrounded by double quotes.

    $ perl -le ' > $s = q{"Foo, Bar", "", "Blah"}; > @e = $s =~ m{"([^"]*)"}g; > print for @e;' Foo, Bar Blah $

    I hope this is of interest.

    Cheers,

    JohnGG

Re^2: split question
by Anonymous Monk on May 29, 2008 at 22:45 UTC
    thanks for both answers!