in reply to Out of Memory Error : V-Lookup on Large Sized TEXT File
Rather than read $LARGEFILE once for each line in $REFFILELIST, wouldn't it be more efficient to read it once and check each line against each line of $REFFILELIST?
Something like:
open (FILE, $ReferenceFilePath) or die "Can't open file"; chomp (@REFFILELIST = (<FILE>)); close(FILE); open OUTFILE, ">$OUTPUTFILE" or die $!; open (LARGEFILE, $LARGESIZEDFILE) or die "Can't open File"; while (<LARGEFILE>) { foreach my $line (@REFFILELIST) { print OUTFILE $_ if (index($_, $line); } } close(LARGEFILE); close(OUTFILE);
N.B. untested since the original is incomplete and doesn't provide any data.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Out of Memory Error : V-Lookup on Large Sized TEXT File
by lonewolf28 (Beadle) on Apr 24, 2015 at 22:41 UTC | |
|
Re^2: Out of Memory Error : V-Lookup on Large Sized TEXT File
by marinersk (Priest) on Apr 25, 2015 at 03:02 UTC |