That is strange. Which version of perl are you using and what platform? If you posted the output from perl -V that would tell us the full story.
Not that this ought to make a difference, if append mode was failing in some build or on some platform, I would have expected it to have been noticed already, but it might rings some bells with someone, somewhere and provide a clue that might help.
With respect to return code checking. The usual idiom is
open OUT, '>>', 'Results.txt' or die "Open for append to Results.txt failed. rc: $!";
The two main differences here are that the error message will be output to STDERR rather than STDOUT which can be useful for seperating error output from 'normal' ouput via command line redirection. And the inclusion of the perl special variable $! which will contain an error message indicating why the operation failed. Good info to have when trying to solve such failures.
There's nothing wrong with the way you're doing it, but I'd advise the incusion of $! to your output.
None of that solves your problem though. I can't think of a situation where opening a file for append would succeed in opening it, but blow away the contents in the process. Maybe someone else has seen this?
If it really in doing this, it might be worth trying the 2-arg form of open
open OUT, '>> Results.txt' or die ...;
If your build of perl really does containing a bug that is affecting append mode, there is a slight chance that using a slightly different code path might change something.
In reply to Re: Re: Re: Sanity Check: Debugging Help Needed!
by BrowserUk
in thread Sanity Check: Debugging Help Needed!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |