open(FH, 'logfile.txt') || die "Could not op en logfile.txt"; @arr=<FH>; # Read whole file into array. my $lines=10; # Print last 10 lines my $start=$#arr-$lines; for $i (@arr($start..$#arr)) { print "$arr[$i]\n"; } close(FH);
In reply to Re: tailing a file without printing its entire contents
by bulrush
in thread tailing a file without printing its entire contents
by ChRy0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |