http://www.perlmonks.org?node_id=201736


in reply to search, replace and backrefrences

I suspect perl is DWIMing your potential $1_0_0_ into $1. The actual fix is to just encose the '1' in curlies like s/ ... /${1}0_0$2/. You use curlies to disambiguate interpolated variables where needed.