in reply to Save 2 files' diff as 3rd file
You might want to check out merlyn's Showing differences between two sequences and the traverse_sequences function. You should be able to modify that to find what you're looking for.
In Section
Seekers of Perl Wisdom