P is for Practical | |
PerlMonks |
Re: How do I find $a only where it's not followed by $b and then replace it with $c?by neshura (Chaplain) |
on Feb 15, 2000 at 03:19 UTC ( [id://3496]=note: print w/replies, xml ) | Need Help?? |
Use Perl's cool
"zero-width negative lookahead assertion".
s/$a(?!$b)/$c/;
In Section
Seekers of Perl Wisdom
|
|