in reply to Replace after match in regex (key value subsitution)
Although others have pointed out that there is a nice one-pass approach to your problem, it is possible to access the location of a match after the match itself:
See perlvar.my $a = 'abc'; $a =~ /(b)/; substr($a, $-[1], $+[1] - $-[1], 'B'); print $a, "\n"; # aBc
In Section
Seekers of Perl Wisdom