in reply to Capture Groups

$result =~ s/(Mr(s)?) a/\1 A/s;

While this is presumably just a cut-down version - used to ask about the unexpected warning you were seeing - your posted sample code made me pull a face ... so if you were to post the complete production regex(en) you are using, we might be able to offer suggestions to improve them. :)

👁️🍾👍🦟