my $count = 0; my $line; # from their POD use File::Tail; # "tail => -1" will start from the beginning of the file my $file=File::Tail->new(name => "/some/log/file", tail => -1); while (defined($line=$file->read)) { print ++$count, " ", $line; }