Seek log file : file seek « File « Perl






Seek log file

    

#!/usr/bin/perl

use strict;
use warnings;

open LOGFILE, "log.txt";

while (1) {
    print "$.: $_" while <LOGFILE>;
    sleep(1);
    seek LOGFILE, 0, 1;
}

   
    
    
    
  








Related examples in the same category

1.Seek a file
2.Seek a minus value
3.Seek and tell.
4.Seek current position
5.Using seek function from IO:File
6.The seek Function randomly accesses a file.
7.The seek Function randomly accesses a file: seek(FILEHANDLE, BYTEOFFSET, FILEPOSITION);
8.File seek operations
9.Move file pointer by using the seek function