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


in reply to Evaluating $1 construct in literal replacement expression

For a thorough discussion of this topic, see nodes printig with variables in text and simple regular expression and, with a bit of redundancy, s/// treat rhs as regex.