Say I have $foo = "bar.baz"
I want to use the scalar $foo to find strings that contain "bar.baz" (anywhere in the string), but not the regex-evaluted version of $foo.
So the line: if( $other =~开发者_如何学JAVA m/$foo/ ) ...
isn't working, because $foo is being evaluated such that the '.' is evaluated to any character. How do I stop that?
Pick one:
$foo = quotemeta("bar.baz");
if ($other =~ m/\Q$foo/)
(Both are actually the same thing, just done at different times.)
精彩评论