#!/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() { $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";
END print "Page "; for $i (1 .. $total_pages) { if ($i == $page) { print "$i"; } else { print "$i"; } if ($i != $total_pages) { print " | "; } } print "
\n"; }