in reply to How to delete lines with similar data

Almost every time you start thinking about unique in a Perl program you are going to be using a hash IMO

You should read every row of NEWFILE and use the lines as the keys of the hash - then in your foreach loop you will use exists using your built up row as the key to test for.

/J\