Hello Everyone! how are you? fine i hope.
How can i print just 5 records per Table row and the next 5 records on the next table row? Much thanks in advance!
#!/perl/bin/perl
print "Content-type:text/html\n\n";
open(INF,"data.txt") or dienice("Can't open data.txt: $! \n");
@grok = <INF>;
close(INF);
print <<EndHdr;
<html><head><title>My Data</title></head>
<body>
<center>
<h2 align="CENTER">My Data</h2>
<table border="1">
<tr>
EndHdr
foreach $i (@grok) {
chomp($i);
($Item,$Page,$Desc,$Pack,$Price) = split(/\|/,$i);
if ($Item eq "") {
print "<td>$Item</td>"<td>$Page</td>"<td>$Desc</td>"<td>$Pack</td>"<td>$Price</td>\n";
}
}
print <<EndFoot;
</tr>
</table>
</center>
</body>
</html>
EndFoot
sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}