#!/usr/bin/perl
use CGI;
my $cgi=new CGI;
print $cgi->header;
#here im using rows module in which i am calculating the no of rows
use rows;
$count = 0;
open (FIN, "data.txt") or die "cant open the file ";
while(<FIN>)
{
$count++
}
$totalcount= $count;
print "$totalcount \n \n ";
#so put all the values inside an array say @total.
$no_per_page=3;
$total_pages=int((scalar $totalcount) / $no_per_page);
print "$total_pages \n \n ";
$remainder = (scalar $totalcount) % $no_per_page;
if ($remainder)
{
$total_pages++;
print $total_pages;
}
if($total_pages)
{
print <<"END";
<table cellpadding="0" cellspacing="0" bor
+der="0" width="100%">
<tr>
<td class="smtxt">
END
print "<b>Page </b>";
for $i (1 .. $total_pages)
{
if ($i == $page)
{
print "<b>$i</b>";
}
else
{
print "<a href=\"winner.cgi?page=$i&period=$p
+eriod\">$i</a>";
}
if ($i != $total_pages)
{
print " | ";
}
}
print "<!-- '$total_pages' '$remainder' --></td></tr></table>\
+n";
}