Hi, I'm new to Perl, and I'm just wandering if Perl can do only a given number of replacements, instead of only one ( s/a/B/ ) or all of them ( s/a/B/g ).
Say I have a string:
and I want to replace only the first three occurrences of "a" with "B", is there a quick command such as ...
illustration only
perl -e '$x="ababababab"; $x =~ s/a/B/3; print $x . "\n"'
BbBbBbabab