in reply to Using variables in regex search

If $str contains characters which are special for regular expressions, use:
$text =~ m/\Q$str/;
See also quotemeta and Quoting metacharacters