in reply to duplicate lines

Your method is fine, you're just doing something extra that you shouldn't be doing. You're ONLY printing the line to the file if it doesn't exist in your %lines hash yet. But then you're printing a newline regardless of that! Either do:
while (<DUPLICATE>) { print DUPremoved if not $lines{$_}++; }
or, if you're really adamant about chomp()ing the line first, do:
while (<DUPLICATE>) { chomp; print DUPremoved "$_\n" if not $lines{$_}++; }

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart