in reply to Matching elements in two arrays and printing the element next to the match.

You must split the row read from first file to move on. In the case there is only one line in this file, you can do such thing:
@array = split / /, <FILE1>; # reads only one line!
instead of
@array = <FILE1>;