in reply to newbie split question

Use something like /\",\"/ for your regexp. Be careful, though... presumably your string looks like '"alpha","beta","gamma"'. Using split will leave the leading and trailing double quote on the first and last elements, respectively. For example:
#!/usr/local/bin/perl my @items = split /\",\"/, '"alpha","beta","gamma"'; foreach (@items) { print "$_\n"; }
will spit out
"alpha beta gamma"
Just make sure you deal with those at some point; I'd probably do something like substr $string, 1, -1 If there's extra garbage in the string, maybe like <CODE>s/\"(.*)\"/$1/</CODE

Replies are listed 'Best First'.
RE: Re: newbie split question
by Anonymous Monk on May 06, 2000 at 17:52 UTC
    Or...
    <code> $string = "\"Foo\",\"Bar\",\"Baz\""; # Split by comma instead... @words = split(/,/, $sting); # ..and then remove the quotes foreach $word (@words) { $word =~ s/"//sg; }
      But that requires a change to the string, in which case you would just make the string more straight forward with a simpler separator.