Hi all, I am trying to write a perl program that compares 2 files and writes the difference to the output file as, Example File1 aa bb ac ad File2 bb cc cd Resultant File cc cd Resultant file should contains only those records that are present in second file but not in the first file. bb is present in File1. But cc and cd of file2 are no where present in file1. Please suggest what is the best way to implement this. I am thinking of the following approach Read files into arrays(one line as an array element), sort them. Loop thru all the line of file2 check if the file is not present int file1. But it doesnt seems to be like good approch. Please suggest on this. Please provide any link or a sample snippet. Thanks in advance.