note
kennethk
Do you mean
<c>
$string =~ /$_/;
$string =~ /\b$_\b/;
</c>
or do you really mean
<c>
$string =~ /\Q$_\E/;
$string =~ /\b\Q$_\E\b/;
</c>
As soon as your variable contains [doc://perlre#Metacharacters], they are not the same. See [doc://quotemeta], [doc://perlre#Quoting-metacharacters].
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-712372">
<hr />
<p>#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.</p>
</div></div>
1190836
1190836