To /^\Q$stack\E$/ (emphasis on the \E).
And to the OP, note that your first RE can be simplified:
#if ($line =~ m/set\sservice\s(\".+\").?/) { if ($line =~ m/set\sservice\s(".+")/) {
No need to escape quotes; nor to match beyond what you are interested in. (I often see REs with a useless .* at the end.)
In reply to Re^2: Problems with a regex?
by hbm
in thread Problems with a regex?
by dwlepage
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |