in reply to "Use of uninitialized value in print" but why ???

print OUTFILE;

Maybe because you're not actually printing anything? Are you trying to print lines that match?

print OUTFILE $lines;

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.