|
|
| XP is just a number | |
| PerlMonks |
Re^3: Delete Duplicate Entry in a text fileby sauoq (Abbot) |
| on Jun 20, 2012 at 11:30 UTC ( #977309=note: print w/ replies, xml ) | Need Help?? |
|
Without having changed your code too much It could stand a bit more changing though. Why use s/// and why the /g if you do? If you are going to do it, chomp $line; is preferable. Now what if the line is "0\n"? Zero is false. Contrived? Okay... then what if the line contains some whitespace before the newline? Whitespace is true. Checking for the truth of !$line isn't really what you mean. You want to skip $line unless it contains a non-whitespace character so just say what you mean: No need to change the line and no need to re-append the newline later.
-sauoq "My two cents aren't worth a dime.";
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||