Anyone who tried to rely on carriege return (line completion) as an indication of file completion for commercial data provision would simply lose the business - a file can be incomplete but accidentally terminate after the "\n" therefore giving a false impression and that stands to happen too regularly -- 1 in n cases of incomplete files where n is the average length of a line.
Such problems that should be allowed to happen and fixed another way entirely.
"instead of a simple chomp". There is no instead of - chomp's functionality is professionally unacceptable from the start. I am saying let it break and fix the cause of the data quality issue instead of hiding it with chomp so you never found it in the first place - otherwise you are second-guessing the testing and correction process.
chomp() or die; would resolve some of the issues but its probably better to use chop as a habit in case you forget - the impact of chop on an unterminated line might be harder to find than die() but at least you are letting it have an impact that can be picked up during testing.
^M Free your mind!
In reply to Re^2: chop vs chomp
by Moron
in thread chop vs chomp
by Moron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |