in reply to Replacing a given character starting with the xth occurence in a string
my $s = "Terence and Philip are sweet\n"; my $c = 'e'; my $r = 1; my $n = 3; ($s=~/((.*?)$c){$n}/)&&(($s,$_)=($&,$'))&&(s/$c/$r/g)&&(print $s,$_);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Replacing a given character starting with the xth occurence in a string
by tye (Sage) on May 22, 2001 at 19:53 UTC |