in reply to Problems with seemingly simple string matching...

You may want to use the :crlf IOLayer which will transform \r\n line endings to \n on input (leaving just "\n" unchanged), like this:
open (IN,'<:crlf', $infile) or die "Cannot open $infile";