in reply to Inserting numbers between parenthese matches in regexp

The replacement part of a regex acts like a double quoted string as far as variable interpolation is concerned, so this should work (untested):
s/([a-m])([n-z])/${1}5$2/g; # ^^^^