in reply to regex: finding something followed explicitly by a dot

You get back 1 because you return $found from fielContainsWord.

Remember that regex special characters in interpolated strings are still special, and a dot with the /s flag matches any character. You don't need /s unless you use the dot as a special character, and you don't need /m unless you are using the string anchors. The /g flag isn't doing you much code here either since you're only matching the string once. To quote possible special characters, you can use the \Q sequence (or quotemeta beforehand).

if($filecontents =~ /\Q$word/) {
--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review