I Have a very large file (80M) which I am parsing line by line with the code below.
$file = "datalog.txt";
open(INPUT, $file) || die("Could not open file - $file!");
while($line=<INPUT>){
chomp $line;
"Search for a string and do something"
}
close(INPUT);
Now when I come across a particular string I would like to load the line containing the string and the next 20 lines into an array for processing. I'm not quite sure how to do this? Any suggestions or alternative ways to do this?
I have tried "Slurping" the whole file into an array at the beginning but this takes forever to run!!!
Thanks,
- Troy
Start Free Trial