I wouldn't say wrong no, but there are modules out there to make things easier such as the CGI module and multiple others.
_____ From: Johnson, Reginald (GTI) [mailto:[EMAIL PROTECTED] Sent: 25 July 2007 16:49 To: beginners@perl.org Subject: FW: Html within code Is coding this way wrong? By "this way" I mean where you don't use a module to write html, but instead do it within the code by using print "Content-type: text/html", "\n\n"; Example program #!/usr/bin/perl print "Content-type: text/html", "\n\n"; open (OMARFILE, "<junk" || die "input file cannot be openned:$!\n"); print <<EOF <html> <head> <title>Omar Metrics</title></head> <body> <div align=center> <h1>TSM OMAR STATISTICS</h1> </div> EOF ; while ( $line =<OMARFILE>) { chomp($line); if ($line ne "" ) { ($fdt,$tod,$cap,$util,$actnodes,$gb,$att,$comp,$comppct,$bdays,$restorecnt,$ req,$setups) = split(/ /,$line); print <<EOF <div align=center> <table border="1" cellspacing="0" cellpadding="0" width="50%"> <tr> <td align="center" valign="middle" colspan="2"><b>OMAR Metrics for $fdt to $tod </b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Backup Completion Percentage</td> EOF ; if ($comppct >= 98) { print <<EOF <b><td bgcolor=00FF99>$comppct</td></b> </tr> <tr> EOF ; } #end if else { print <<EOF <b><td bgcolor=YELLOW>$comppct</td></b> </tr> <tr> EOF ; } #end else print <<EOF <td valign="middle" bgcolor="#00FFFF">Total Backup Attempts</td> <td><b>$att</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Total Backup Completions</td> <td><b>$comp</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Total Client Disk Capacity</td> <td><b>$cap</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Total Client Disk Utilization</td> <td><b>$util</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Total Active Client Nodes</td> <td><b>$actnodes</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Total Restores</td> <td><b>$restorecnt</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFFF">Total Business Days</td> <td><b>$bdays</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFF">Gigabytes Written To Tape</td> <td><b>$gb</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFF">Remedy Client Request</td> <td><b>$req</b></td> </tr> <tr> <td valign="middle" bgcolor="#00FFF">New Client Setups</td> <td><b>$setups</b></td> </tr> </table> <br> </div> </body> </html> EOF ; } #end if else { next; } #end else } #end while close(OMARFILE); Sample junk file '06/01/2007 00:00' '06/30/2007 23:59' 235 118.75 566 43 11 10 98.900 21 204 2 '05/01/2007 00:00' '05/31/2007 23:59' 230 113 560 41 12,324 12,025 97.500 23 33 21 '04/01/2007 00:00' '04/30/2007 23:59' 227 107 552 38,807.0 11 11,784 98.300 21 15 24 _____ This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secure or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/ <http://www.ml.com/e-communications_terms/> . By messaging with Merrill Lynch you consent to the foregoing. _____ "Please consider the environment before printing this email." This e-mail is from the PA Group. For more information, see www.thepagroup.com. This e-mail may contain confidential information. Only the addressee is permitted to read, copy, distribute or otherwise use this email or any attachments. If you have received it in error, please contact the sender immediately. Any opinion expressed in this e-mail is personal to the sender and may not reflect the opinion of the PA Group. Any e-mail reply to this address may be subject to interception or monitoring for operational reasons or for lawful business practices.
<<attachment: RecyclingSymbolGreen.jpg>>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/