in reply to split function using multiple delimiters

"it could't show the full content"
Neither does your question provide "full content" when the phrase is used to mean "a clear description" of your problem.

The split you show, executed against the source string (presumptively $cont is the string you showed initially), produces an array as you appear to expect. The content of that array, via Data::Dumper, is:

$VAR1 = '<P_contrib-author>Allan Wigfield'; $VAR2 = ','; $VAR3 = ' Susan L. Klauda'; $VAR4 = ','; $VAR5 = ' '; $VAR6 = 'and'; $VAR7 = ' Jenna Cambria</P_contrib-author>';

So... is your question

WAG: You might find producing the desired output easier if you deal first with the tags and the substantive content. If your data is uniform -- contains (identical) <P_contrib-author> tags each time you need to extract authors -- identify, modify, and strip them out for your later use before dealing with the authors list.

But, I suspect the style of your data will vary from item to item... omitting the Harvard comma, using an ampersand instead of "and" and so on... so the overall solution won't be a single PATTERN for use in split, anyway.

Replies are listed 'Best First'.
Re^2: split function using multiple delimiters
by educated_foo (Vicar) on Dec 27, 2011 at 12:05 UTC
    You're sure in the running for the "unhelpful reply of the day" award (OMG! He didn't "use strict" either!), but at least you said one useful thing:
    But, I suspect the style of your data will vary from item to item... omitting the Harvard comma, using an ampersand instead of "and" and so on... so the overall solution won't be a single PATTERN for use in split, anyway.
    Parsing citations is pretty hard unless they are machine-generated. There are a bunch of formats, and people regularly screw them up.

      I thought the results of the code from the OP was helpful. That would have been nice to see in the OP.

      You're sure in the running for the "unhelpful reply of the day" award
      I think ww's response is the best post in this thread.
        How so?
        OP: How do I split a string on comma and/or "and"?

        ww: (lots of stuff not answering the question)

        How is that helpful?