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
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