Howdy!

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.

yours,
Michael

In reply to Re^5: chop vs chomp by herveus
in thread chop vs chomp by Moron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.