What Corion said, that's not a question it's a spec.
use strict;
use warnings;
open files
check each line of source file
If it matches set a found_it flag to 10
if found_it is set
print line to output file
decrement found_it
That's it
Have a go at coding up the above in Perl.
When it doesn't work and the error messages don't point you in the right direction use diagnostics;
If that fails ask a question with some evidence of effort on your part.