in reply to Re: split with '|'
in thread split with '|'

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;

Replies are listed 'Best First'.
Re^3: split with '|'
by jbrugger (Parson) on Apr 22, 2005 at 06:33 UTC
    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.