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{$_}++;
}
Jeff japhy Pinyan,
P.L., P.M., P.O.D, X.S.:
Perl,
regex,
and perlhacker How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart