[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[FWP] Re: Substitution



On 990620, Juanma Barranquero wrote:
> $text =~ s/$pat/$s1/;
> 1 while ($text =~ s/$pat(.*?)$pat/$pat$1$s2/);

$count = 0;
$text =~ s/$pat/$count++ == 0 ? $pat . $s2 : $s2/eg;

would do it more directly, no?

If you know that $s2 won't be in the $text until it's put there by this,
$text =~ s/$pat/$s2/g; 
$text =~ s/$s2/$pat$s2/;

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org