Your code looks more like "c" than perl. Nevertheless, with only minor changes, it could be made to work if the fields in your files consist of single characters separated by single spaces. I am not going to suggest such a solution because you would miss the opportunity to learn how to use character strings and arrays-of-arrays in perl. Perl's handling of character strings is probably its greatest advantage over other languages.
For small data files, I would recommend reading each file into an array of records. Each record would be formed by splitting a line into an array of fields (much as you do already) and storing a reference to that array.
You could then use nested loops to compare the arrays. The biggest advantage over your existing code is that you would be comparing strings (There is no need to split them into characters).
Learn to use perl's built-in documentation. Refer to perldata for information on strings and perldsc (and it references) for information on arrays-of-arrays.