Sheman, Do it the perl way, hash it. 1. Read both files 2. Put the lines into the key of a hash. * While (reading files) * $hash{$_}++;
Now you can print/process your hash key. There’s shouldn’t be duplicates. From: Sherman Willden <sherman.will...@gmail.com<mailto:sherman.will...@gmail.com>> Date: Monday, July 21, 2014 at 3:01 PM To: "beginners@perl.org<mailto:beginners@perl.org>" <beginners@perl.org<mailto:beginners@perl.org>> Subject: Please check my logic I checked CPAN for remove duplicate lines and only found Code::CutNPaste which doesn't sound like what I want. So I will build what I want although I'm sure it's out there somewhere. I have several files and I attached one of them. I want to sort the file and remove duplicate lines. The file is a list of key phrases to search the internet for. These are long lines so I don't know if this will work. I would like the file to be generic. Is my logic below correct? Check perl file for two inputs: <file-to-be-read-from> <file-to-write-to> Create array which will end up with all non-duplcate lines Open <file-to-be-read-from> Read in <file-to-be-read-from> Search the array If the line read in is not in the array, place it in the array Close <file-to-be-read-from> Open <file-to-write-to> For each line in the array, write that line to <file-to-write-to> Close <file-to-write-to> Sort <file-to-write-to> Thank you; Sherman