Unless you have a specific reason to use perl for this task (like you want to learn it, for example), why not just use diff?
If you do want to learn perl, then as the saying goes "I wouldn't start from here...". A naive comparison program is easy enough, if the records of both files are sorted...