note
LanX
<I>> But is there a more elegant way to do that, one that might also pick up some of the others?</I><P>
yes, see [DOC://quotemeta|<tt>quotemeta</tt>] resp. <tt>\Q</tt> and <tt>\E</tt> °<P>
<H5> demo</H5>
<c>
>perl
$v1 = "*hello";
$v2 = "*hello";
print quotemeta($v2),"\n";
print "match" if $v1 =~ /\Q$v2/;
__END__
\*hello
match
>
</c>
<div class="pmsig"><div class="pmsig-708738">
<!--nowiki--><p>Cheers Rolf<br>
<sub>(addicted to the Perl Programming Language :)
<br> <i> [id://1153804|Wikisyntax for the Monastery]</i>
</sub>
<!--nowiki-->
</div></div><P>
°) also [DOC://perlre#Quoting-metacharacters|<tt>perlre#Quoting-metacharacters</tt>] <!-- Wiki2Monks {"version":1.161} -->
11145616
11145616