Basically what I am trying to do is read the content of all the files in a specific directory and redirect the output to one text file. e.g. 3 small log files.

See my previous post(s). I see no need to "read the content" of the files because you are not doing any processing of the input. Treat them all as binary files and slam them together as a single output file using either "copy" on Windows or "cp" on Unix. If for some reason that doesn't meet your requirements, then give a short example with a couple of dummy files showing the problem. I don't see any "red flags" for performance issues here. But in general reading files line by line in text mode will be much slower than using an O/S command to append all of the files into a single file using a binary mode copy, even considering the overhead of launching the O/S command.


In reply to Re^3: read files one by one in directory and redirct output to a file by Marshall
in thread read files one by one in directory and redirct output to a file by TonyNY

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.