I need to write a PERL script to compare two files not in the same sequence.

ie. Take one line from first file....compare with all lines in second file....If there is no match....put it in a third file

If there is any match ...leave that line...and go to the second line in the first file....again compare with all lines in second file.

Continue the same procedure till we reach the end of the first file....