Ellhar:

If I had to guess, I'd suspect that your program is taking a long time to execute, and you're not letting it run to completion. Instead, you might be monitoring the file size and worry .... "Hmmph! My program isn't doing anything. Perhaps it's in an infinite loop?" and killing it. Since it hasn't written anything to the file, it remains empty.

If that's the case, then you're probably suffering from buffering and should turn buffering off on the output file so that each line is written to the output file as it's printed in your program.

...roboticus

Update: I guess I could've mentioned a couple of solutions... You could pepper your code with calls to flush (e.g. SUMMARY->flush() to write the output to disk immediately. But then you'd have to use IO::Handle; at the start of your program and manually insert all those calls. A better way would be to tell the filehandle to flush itself on every print/write statement. You can do this by adding SUMMARY->autoflush(); just after your open statement. You'll still need the use IO::Handle; at the beginning though. Read perldoc perlvar for more details.


In reply to Re^3: Can't write to open writeable Filehandle by roboticus
in thread Can't write to open writeable Filehandle by Ellhar

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.