Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/env perl use warnings; use strict; use Data::Dumper; my $file="MySpace.html"; my $cmdString = "/tmp/"; chdir($cmdString)|| die "Error: could not '$cmdString'"; if (-e $file) #if the file exists { $cmdString="rm $file"; system($cmdString)==0 or die "Error: could not '$cmdString'"; } open(my $FILE, ">>$file") or die "Cannot open $file: $!"; ## >> means +append to the end of file. my $fontColor="D2L"; my $empNo=43432; my $empName="Marconi"; my $empDesg="Managed Director"; my $empSal="59999.99"; print $FILE "<HTML>\n"; print $FILE "<table width=\"100%\">\n"; print $FILE "<tr><th colspan=\"4\" class=\"H25H\">HelloWorld</th></tr> +\n"; print $FILE "<tr><th class=\"H25L\">Emp#</th><th class=\"H25L\">Name</ +th><th class=\"H25L\">Designation</th><th class=\"H25L\">Salary</th>< +/tr>\n"; If ( $empDesg == "Managing Director") { $fontColor="W30L"; } print $FILE "<td class=$fontColor>$empNo</td><td class=$fontColor>$emp +Name</td><td class=$fontColor>$empDesg</td><td class=$fontColor>$empS +al</td></tr></table>\n"; print $FILE "<br><br>\n"; print $FILE "<head><META http-equiv=\"Content-Type\" content=\"text/ht +ml; charset=UTF-8\"><style type=\"text/css\">table {border: 1 solid b +lack; border-collapse: collapse; } th {border: 1 solid black; width: +20%; text-align: left; background: #B8B8B8} td {border: 1 solid black +; width: 80%} .H25H {border: 1 solid black; width: 25%; text-align: c +enter} .H25L {border: 1 solid black; width: 25%; text-align: left} .D +2L {border: 1 solid black; width: 25%; text-align: left; background: +#DDDDDD} .W30L {border: 1 solid black; width: 25%; text-align: left; +background: #DDDDDD ; font-size : 12pt; font-weight: bold; color:red} +</style></head></html>\n"; close($FILE); print "Your html has been created";

In reply to Create HTML files using perl on the fly by sKore

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-19 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found