Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Constructing HTML tables with CGI.pm

by dws (Chancellor)
on Mar 28, 2003 at 07:23 UTC ( [id://246412]=note: print w/replies, xml ) Need Help??


in reply to Constructing HTML tables with CGI.pm

It looks like you're headed towards something like the following (untested) fragment.
print $q->header('text/html'), $q->start_html('yada yada'), $q->h2('more yada'), $q->hr, $q->table( { -border => 1, -width => '100%' }, ( map { $q->Tr( $q->td($_), $q->td($host{$_}) ) } sort keys %host )), $q->end_html;
Note how map replaces the foreach you thought you'd need.

Note also that you want the header to be 'text/html'. 'text/plain' will work for some browsers (e.g., IE), but only because they try to outsmart the content type if the the body looks like HTML. Don't rely on this behavior.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246412]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found