Why not use diff?
Or one of the Diff modules on CPAN?
In reply to Re: on matching content of two text files by Skeeve in thread on matching content of two text files by sarvan