in reply to help with search and match

My first choice would be to sort the two files and use the 'join' command instead of perl, e.g.:
sort -o file1 file1 sort -o file2 file2 join file1 file2 | awk '$2 == $4'