open my $fhi, '<', 'C:\shekhar_Axestrack_Intern\WindowCreation\ListOfIpAdress.txt', or die "Could not open file $!"; open my $fho, '>', 'C:\shekhar_Axestrack_Intern\WindowCreation\ListOfIpAdress2.txt', or die "Could not open file $!"; while (my $line = <$fhi>) { print "Total Difference in Hour is : $div \n\n"; print $fho $line unless $div > 36; } close $fhi; close $fho; rename 'C:\shekhar_Axestrack_Intern\WindowCreation\ListOfIpAdress2.txt', 'C:\shekhar_Axestrack_Intern\WindowCreation\ListOfIpAdress.txt';