in reply to compare 2 files and return the number of similar sentences

You are going to want to use eq instead of == for your comparison. In perl, eq is for string comparisons and == is for numerical comparisons. Also, including use strict; and use warnings; at the top of your script will save you a lot of grief in the long run.