while () { print DUPremoved if not $lines{$_}++; } #### while () { chomp; print DUPremoved "$_\n" if not $lines{$_}++; }