ormy $i= 0; $str =~ s/(...)/ 3 == ++$i ? 'fish' : $1 /ge;
my $i = 3; 0 while $str =~ /fsih/gi && --$i; substr( $str, $-[0], $+[0]-$-[0], 'fish' ) if ! $i;
- tye
In reply to Re: Replacing a specfied instance of a pattern in a string (2 more)
by tye
in thread Replacing a specfied instance of a pattern in a string
by krisahoch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |