in reply to Printing to a file problem

You may also have a buffering problem, try turning on autoflush with:
$|++;
This will let the data be written to the file immediately. It may be that you are closing your file handle before the data is actually written out.

Replies are listed 'Best First'.
Re: Re: Printing to a file problem
by Arien (Pilgrim) on Aug 22, 2002 at 21:56 UTC
    It may be that you are closing your file handle before the data is actually written out.

    Closing a filehandle automatically flushes anything left in the buffer.

    — Arien

      I seem to have mistated myself. What I meant to say is that the data has not yet been written to the file when he attempts to read from it and turning on autoflush would take care of that problem. You are correct about flushing on close. In the sample code here there is no close, so I must assume that he is trying to read from the file just after the write and before any close on the associated file handle.