Rob Das wrote:
> Hi All:
>
> I added the following line to my program:
> $/ = \65536;
>
> This was because I'm running out of memory when slurping entire files into
> memory (potentially hundreds of meg). However, the (separate) log file I'm
> writing afterwards is not getting created - nor am I getting any error
> messages. If I comment this line out, it works fine. I tried the following:
> $opfh = select(OUTFILE);
> $| = 1;
> select ($opfh);
>
> ... to try and flush the buffer, but to no avail.
>
> Would someone tell me what I need to do to get this file written out please?

You need to comment out the line

  $/ = \65536;

since it is preventing your log file from printing, and doing nothing
else useful. (I suspect that it is being treated as a 16-bit integer and,
since 65536 == 0x10000, this is being evaluated as zero.)

The buffer size cannot help you to accommodate overly large files. If
you try to slurp the entirety of a file that will not fit into your
virtual memory then you cannot do it - even by reading it in Very Big
Chunks.

I have never seen a problem whose solution needs all of a file's
contents in memory simultaneously. Why not tell us what you are trying
to do and how you have tried to do it. Then we will help.

By the way, the cleanest way to autoflush a filehandle is

  use IO::Handle;
  autoflush OUTFILE;


Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to