$substitution = qr/s~$sv$ch$ww$regexM$ww$ch$ev~$regexR~g$regexI/; $line =~ $substitution;