I think this code is simple enough to understand what is going on, but if you need to explain more I will. (I have to get some real work done first ;)my @lines; my $currLine = 0; my $maxLines = 10; # Go through the file, saving the last $maxLines while (<>){ $lines[$currLine] = $_; $currLine++; $currLine = 0 if ($currLine == $maxLines); } # Print out the last $maxLines for (1..$maxLines){ print $lines[$currLine]; $currLine++; $currLine = 0 if ($currLine == $maxLines); }
In reply to Re: tail a file in perl
by SarahM
in thread tail a file in perl
by gnu@perl
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |