is indeed one way to use it properly.$text =~ /\Q$search/
Another, more primitive way to achieve the same effect is to precede every \W character with a backslash. That is actually exactly what quotemeta does.
$search =~ s/(\W)/\\$1/g; # same as: $search = quotemeta($search); $text =~ /$search/ # no "\Q" tis time!
In reply to Re: How to disable Pattern Matching ?
by bart
in thread How to disable Pattern Matching ?
by Coppiete
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |