in reply to Re^3: How to delete a particular line in a text file after some operation on that text file at the same time
in thread How to delete a particular line in a text file after some operation on that text file at the same time
open my $fhi, '<', 'C:\shekhar_Axestrack_Intern\WindowCreation\List +OfIpAdress.txt', or die "Could not open file $!"; open my $fho, '>', 'C:\shekhar_Axestrack_Intern\WindowCreation\Lis +tOfIpAdress2.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 +';
But as a result file ListOfIpAdress.txt is blank which was supposed to be replaced by ListOfIpAdress2.txt which we obtained from print $fho $line unless $time > 36; The problem is i want to have the output in the same file not in 2 different files.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: How to delete a particular line in a text file after some operation on that text file at the same time
by soonix (Chancellor) on Jan 18, 2015 at 06:48 UTC | |
|
Re^5: How to delete a particular line in a text file after some operation on that text file at the same time
by james28909 (Deacon) on Jan 18, 2015 at 06:25 UTC |