in reply to
compare 2 files and print to a third
Look at
this utility
I posted a while back -- it does something quite close to what you want (and some other related stuff besides, which you might find helpful).
Comment on
Re: compare 2 files and print to a third
In Section
Seekers of Perl Wisdom