Why use IO::File
Eh, why not? It's part of Perl CORE, isn't it? I don't deny that there are many other ways to do I/O (with plain open or using IO::Handle for instance), but is there a drawback with IO::File?
Also when you read the input file, the line terminator is still there, and then you're adding another one with your join.
Indeed! I forgot to chomp! Thank you for pointing this out.
is your script running on Windows or Unix?
The program is supposed to be run on either Windows or Unix. I try to make it as independent as possible (I try to avoid coding two variations of the program for each platform). The input file is guaranteed to have 0x0a as line terminator, even when run under Windows.
I actually leave out the closes usually.
Then I would have at least to flush the buffers, otherwise other applications won't be able to access the file, until my program terminates. Also, I think they won't be able to open the file for writing while I still have it open, though this might be platform dependent. In both cases, a close makes sense IMO.
-- 
Ronald Fischer <ynnor@mm.st>

In reply to Re^2: Can't get rid of \r by rovf
in thread Can't get rid of \r by rovf

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.