Hi Folks,
I have been in and out of perl for a while and I'm a novice, so please bare with me. I searched for a solution, but still came up empty and hope you find folks can help me out.
I have a form that writes to a tab delimited file...works great. However, I want to print those results to an HTML page -- so you can just view the FF as an HTML page/URL. Here is what I have come up with that writes to a FILE called results.html but results.html is blank in the browser. Can you help me find what I'm missing?
Also note the brute force nature, sorry for that, but as I said I'm a novice that just dabs in perl from time to time.
#!/usr/bin/perl
open(OUTFILE, ">results.html");
print OUTFILE "<html><head>";
print OUTFILE "<title>Summit Results</title>";
print OUTFILE "</head>";
print OUTFILE "<body>";
print OUTFILE "<table border='1'>";
print OUTFILE "<tr>";
print OUTFILE "<td>Company</td>";
print OUTFILE "<td>Address</td>";
print OUTFILE "<td>Name</td>";
print OUTFILE "<td>Email</td>";
print OUTFILE "<td>Phone</td>";
print OUTFILE "<td>fjskdfjskla</td>";
print OUTFILE "<td>fjsdklfja</td>";
print OUTFILE "<td>fhjsdhfj</td>";
print OUTFILE "<td>Pfjdskl</td>";
#... there's 25 fileds
print OUTFILE "</tr>";
open (FF,"mylogfile.log") or die("There was a problem opening the file
+.");
while ($entry=<FF>) {
@fields=split(/ /,$entry);
print OUTFILE "<tr>";
print OUTFILE "<td>$fields[0]</td>";
print OUTFILE "<td>$fields[1]</td>";
print OUTFILE "<td>$fields[2]</td>";
print OUTFILE "<td>$fields[3]</td>";
print OUTFILE "<td>$fields[4]</td>";
print OUTFILE "<td>$fields[5]</td>";
print OUTFILE "<td>$fields[6]</td>";
print OUTFILE "<td>$fields[7]</td>";
print OUTFILE "<td>$fields[8]</td>";
print OUTFILE "<td>$fields[9]</td>";
#... there's 25 fileds
print OUTFILE "</tr>";
}
close DB;
print OUTFILE "</table>";
print OUTFILE "</body>";
print OUTFILE "</html>";
close OUTFILE;
Also, I think I can just do print to >>WHATEVER instead of all of the OUTFILE calls right?
Thanks all!
LakeTrout
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.