$_ = "master442arb_ba"; $rule = "master\(.*\)arb_ba"; $action = "m\$1a_ba"; s/$rule/$action/; #s/master(.*)arb_ba/"m${1}a_ba"/; print $_;
The correct output is "m442a_ba". The commented s/// command gives the correct
output but if I try the same thing with the $rule and $action variables,
it gives "m$1a_ba" as the output. Can someone explain why and what would be the correct expression?
In reply to Using scalar variables as substitution regular expression by addy7de
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |