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


in reply to Pattern Matching

I would suggest you to use strict; and use warnings;.

There are missing the opening " characters in your error handling on opening the file.

If I understand your problem, perhaps grep is the tool you are looking for, not Perl's grep, the one of your operating system.


You can't use the same filehandle 'File' for two different files. And I suggest lexically filehandels.


cnt++; is no Perl construct. I guess you want wto say $cnt++;. Id would be finde, if you would only show us code, that runs without errors and warnings.