I explained before that point already in the OM that the proper approach is something else e.g. to put a trailer on the end. Some established services create a separate .done file to signal competeness.

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

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.