sub delete_nth { my ( $str, $pat, $n ) = @_; my $cap = "$pat.*" x ( $n - 1 ); $str =~ s/($cap)$pat/$1/; return $str; }
Makeshifts last the longest.
In reply to Re^2: Regexp: Only tr second occurance
by Aristotle
in thread Regexp: Only tr second occurance
by Evyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |