in reply to problem while searching for a pattern in a file
Hi,
I have executed your program in my system.It sent the mail only if the pattern get matched.
I have tested your code with the following input.
Input
contents of results.txt
\n
\n
\n
This is testing
In this case mail didn't send.
And,
if($line!~m/\b$pattern/)
This condition will match the pattern other than "hello".
So when newline is encountered this condition will get true.(\n!="hello").
So in this case also mail will send.