Hi All,
Does $filehandle->autoflush(1) force Perl to clear the memory required by the $filehandle?
I understand that it flushed the buffer to the file after every write/print, but if I only need to append lines to a file, and never read the file, will this also reduce the memory requirements of my script?
I am using $filehandle along with Text::CSV_XS.
I will be reading in a >100GB file, and storing a large buffer of 20GB in filehandles waiting to write would significantly bog down (if not crash) the application.
Also, is there any difference in memory requirements between opening the filehandler's file in ">" mode versus append ">>" mode?
Are these the only two additions I would need to make to the code, or would I need to create a new IO object first?
Code:
use IO::Handle;
# create new output file for that year
my $curOUTERRORfile = "ERRORSyear$CURyear.csv";
my $curOUTERRORfilecsv = Text::CSV_XS-> new ({ binary => 1, eol => $/ });
open my $curOUTERRORfilefh, ">", "$curOUTERRORfile" or die "$curOUTERRORfile: $!";
$curOUTERRORfilefh->autoflush(1);
Thanks for your help!!!
Doug