in reply to
Opening file and checking for data
I'm surprised that nobody yet mentioned not using Perl at all! What you want to do is possible with Gnu grep from the command line...
grep --count thepattern whateverfile
[download]
Of course, this may not meet your requirements - notably, this returns a count of the lines matched per file rather than pattern matches per file. YMMV
Comment on
Re: Opening file and checking for data
Download
Code
In Section
Seekers of Perl Wisdom