There's a utility that does that, and existed and matured even before Larry came up with the idea to create Perl. It's called "grep". Use it. "Code reuse" doesn't stop at the CPAN border.
Comment on Re: searching several files for a string at one time