Friends,

I need to process 300+ MB text files. I tried to open one such file; read 10
lines (line by line) and output those 10 lines to a new text file. Despite
reading line by line, it was taking a very long time for processing. Is
there anything that I can try to speed it up!!

Here is my pronto code:

###########################
#!/usr/bin/perl
use strict;
my $from        = "humongous.txt";
open(INP, $from) or die "cannot open input file $!";
open(OUT, ">sample.txt") or die "cannot open input file $!";
print("trying to read input file\n");
while(<INP>){
        print STDOUT;
        print OUT;
        last if($. >= 10);
}
close(INP);
close(OUT);
##########################


Thanks,
Rex

Reply via email to