$test ="foo";
$bar ="bar";
$test =~ s/fuubar/$testYes$bar/giSee how $test runs on into "Yes" in the replacement? That's going to be interpreted as a variable with the name "$testYes" instead of $test + "Yes". What do you use for a spacer to get that interpreted right?
I just ran into that problem today and used this:
$test =~ s/fuubar/${test}Yes$bar/gi
Andreas
would reorganise any $0..$9 variables in the substitution.
To use parens for grouping but not storing matches you can use
(?:what¦when)ever.
$_ = "<title>Nick Carter sucks!</title>";
($verb) = m [perldoc.com]!(?:Aaron¦Nick)\s*Carter\s*([^<]+)</title>!;
$verb would contain "sucks!".
Andreas