I am trying to write a perl script that will read a number from a file,
use that as a counter, and only print out lines above that counter number.
So if the number is 5 and the file is 10 lines, only the last 5 lines
would be printed.
The problem is when it prints out it misses one line, so instead of
printing 5 lines it will print the last 4 lines.
Any help much appreciated.
# $text is the counter variable
open(FD,"$file") || die "Can not open $file";
while(<FD>) {
my $lineNo = "0";
while ($line = <FD>)
{
print "lineNo is $lineNo and text is $text\n";
next if ($lineNo < $text);
print $line;
}
}
close FD;
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.