in reply to split with '|'

The above coding is not working properly, could anyone find what is the problem.

Sorry for posting the question here, as i could not able to edit the above node.

Replies are listed 'Best First'.
Re^2: split with '|'
by ikegami (Patriarch) on Apr 22, 2005 at 06:29 UTC

    Here you go:
    map '<contributor>'.$_.'</contributor>', split ........

    Update: nm, it doesn't work. It's way too complicated to do this with split. I don't think it's even possible to do it with one map, one split, and no other looping commands.

    Here's a version that uses split, but only after fixing the location of the comma:

    $au =~ s{,(<SUP>.*?</SUP>)}{$1,}g; $au = join '', map "<contributor>$_</contributor>\n", split /,\s*/, $au;
      Still tired ;-)? Unmatched ( in regex; marked by <-- HERE in m/,(( <-- HERE ?:<SUP>.*?</
      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re^2: split with '|'
by thor (Priest) on Apr 22, 2005 at 09:39 UTC
    Sorry for posting the question here, as i could not able to edit the above node.
    No need to be sorry. If you sign up for an account, you can edit your nodes. That way, we can attribute questions with a person. Accounts here are free (definately as in beer, mostly as in speech).

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come