Of course, on a Unix/Linux system you can do this with the diff command, with appropriate options (that might be system specific).

I say this because this is an extremely common requirement and yet it is also very common to build one-off custom programs to satisfy such requirements. I say that without specific reference to this particular case or person. “I need to write a program to do this” is a conclusion that is quickly and easily jumped-to, especially when the prospect of doing so seems daunting. TMTOWTDI™, and sometimes TOWTDI isn’t Perl or a custom program at all.