HI
I am using cgi to display a text file in an html table on a web site.
This is easy when it is all in a line separated by spaces, each new row
in the table uses a new line of data in the text file.
What I am having trouble with is when all the data is in one line, one
below the other:
For example:
test/
3
adam/
4
dog/
5
What I want to do, is output this data in an html file, maybe a table,
but I want to add some text before the text data in the file and the
letters kb after the numbers. What I tried was this: But this just
duplicated the data, i.e put the text after the text input as well as
after the number and KB after both as well.....
#!/usr/bin/perl
print "Content-type: text/html\n\n";
open infile, "</www/webs/affinityinternet.co.za/stats/webusage/libweb";
print <<"EOF";
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Web Site URL</title>
</head>
<body>
EOF
while (eof(infile) ne 1) {
$inline = <infile>;
chomp $inline;
@line = split (" " , $inline);
print <<"EOF";
<table border="0" width="100%">
<tr>
<td width="50%">text here$line[0]</td>
</tr>
<td width="50%%">$line[0]KB</td>
</table>
EOF
}
print <<"EOF";
</body>
</html>
EOF
The information in this e-mail, and any attachment therein, is confidential and for
use by the addressee only. If you are not the intended recipient, please return the
e-mail to the sender and delete it from your computer. Although Affinity Internet
attempts to sweep e-mail and attachments for viruses, it does not guarantee that
either are virus-free and accepts no liability for any damage sustained as a result
of viruses.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]