in reply to Out of Memory Error : V-Lookup on Large Sized TEXT File
#usr/perl -w use strict; my $inPath = "somepath"; my $outPath= "outfile"; my $largefile = "large file"; open (INFILE, "<", $path2File) or die "Can't open $path2File for read"; open (OUTFILE, ">", $outPath) or die "Can't open $outpath for write"; open (LARGE, ">",$largefile) or die "Can't open $largefile for write"; #I don't see why this is necessay! #do something here.... while (<INFILE>) { .... print OUTFILE "some_data\n"; } #in general, open the files that you #need to use at the beginning of the program and then #use those file handles. #A "re-open" of a file handle for append is very #"expensive" thing within a loop in terms of performance. #Don't do that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Out of Memory Error : V-Lookup on Large Sized TEXT File
by TheFarsicle (Initiate) on May 03, 2015 at 07:29 UTC | |
by BrowserUk (Patriarch) on May 03, 2015 at 09:32 UTC | |
by Marshall (Canon) on Jun 07, 2015 at 12:18 UTC | |
by Marshall (Canon) on May 09, 2015 at 02:40 UTC |