while (my $line = <$fhi>) { //Here i write the code to get the time from text file in ech li +ne and below i check in if condition if that exceed 34 hours then flu +sh that line if($Time >'34') { $fhi->autoflush; } print $fho; }
The autoflush function isn’t going to help you here. You need logic like this (untested):
while (my $line = <$fhi>) { # get $time print $fho $line unless $time > 34; }
That is: print to the output file only those lines which pass the test, and silently ignore those which don’t. And note that your statement: print $fho; needs to be changed to print $fho $line; in order to work correctly here.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
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
by Athanasius
in thread How to delete a particular line in a text file after some operation on that text file at the same time
by ppp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |