http://www.perlmonks.org?node_id=999790


in reply to File handles in regular expressions

Did you forget to chomp $comp2? Lines read from file handles can contain newline characters (usually \n).
Sorry if my advice was wrong.