open my $fhi, '<', 'C:\shekhar_Axestrack_Intern\WindowCreation\ListOfIpAdress.txt', or die "Could not open file $!"; open my $fho, '>', 'C:\shekhar_Axestrack_Intern\WindowCreation\ListOfIpAdress.txt', or die "Could not open file $!"; while (my $line = <$fhi>) { //Here i write the code to get the time from text file in ech line and below i check in if condition if that exceed 34 hours then flush that line if($Time >'34') { $fhi->autoflush; } print $fho; } close $fhi;