About the only thing that looks suspect to my eyes is that you are not checking the return code from open or close.

I can't think of situation in which an error in either would cause the open for append to blow away and overwrite the existing data, and this appears to be one possibility. Is the output you are seeing in Results.txt from the first file processed or the last?

If it is the last, that would suggest that the '>>' mode is being ignored somehow, which seems unlikely.

If the output is from the first file, that would tend to indicate that the subsequent attempts to re-open the file for append are failing for some reason. Which seems unlikely as you would be seeing lots of 'print() on unopened filehandle' messages--unless that use strict; migrated it way into the code just prior to posting :)

Either way, try adding so or die ...$!; clauses to the open and close calls and see what if anything that reveals.

As an aside, have you checked to see that you have enough disk space free? You could even add an or warn ...$!; clause to your print statements to check for disk full errors etc.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: Sanity Check: Debugging Help Needed! by BrowserUk
in thread Sanity Check: Debugging Help Needed! by Anonymous Monk

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.