It is trivial to create a file in vi with no trailing newline. That's a program in a unix environment.
You are projecting your sense of "what is normal" onto everyone else's situation. It doesn't work that way. So far, in this discussion, I don't recall anyone else having to treat a text file without a trailing newline as "broken". If *your* particular functional requirements *demand* that files always end with a newline, then you have to take the necessary steps to validate your files. It does not then follow that the normal use of chomp() on line-oriented text input is somehow defective on its face.
"Normal" for most of us is that we just don't need to care about that trailing newline. You seem to have a real blind spot about that. Telling us that we are somehow "unprofessional" if we just use chomp() is absurd. Telling us that we would be better off to use "chomp or die" is equally absurd. You are trying to create a cargo-cultish practice, and we aren't going for it.
In reply to Re^5: chop vs chomp
by herveus
in thread chop vs chomp
by Moron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |