I tried this code.
Code:
use strict;
use warnings;
use Fcntl qw(SEEK_SET SEEK_CUR SEEK_END);
open($file1) # I didn't put full line
open (F_log)
while (my $line = <$file1>) {
my @fields = split " ", $line;
my $length = @fields;
for (my $i=3; $i<5 ;$i+="1") {
$i_d = $fields[$i];
last if ($.==1);
seek F_log, 0, SEEK_SET; # not working
while(my $LINE = (<F_log>)) {
if ($. >= $a ) {
if ($LINE =~ /^\s+(\w+)\s\s"(\w+)",/) {
if ($1 eq $i_d) {
$fields[$i] = $2;
last;
}
else
{
$fields[$i] = "Error:$i_d";
};
};
};
};
};
}
close
close
I want to read whole <F_log>
everytime their increment in loop. I tried other method of opening/closing file inside while loop and it works but I think that will increase run time memory of script(Not Sure). So now I am trying to reset the pointer to starting but it's not working. Can anyone suggest anything? And also if anyone tell what all things increases the run time memory of script. Thankyou