CGI table tidy layout possible?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Can CGI print tidy html? The below code seems correct as per CGI
documentation but the output is a mess. If there's anything not
displayed right and I have to rummage through the HTML to figure out
what it is, it's not very easy because of the awfully formatted HTML.

Here's my code, my live data is sixty lines so you can imagine how that
HTML looks.

use warnings;
use strict;
use CGI qw/:standard *table/;

my $names;

while (<DATA>) {
    my ($name, $code) = split /\|/;
    $names-> = $code;

print header, start_html(), start_table(),
    map {
            td([$_, $names->])
    } sort keys %$names;
print end_table();

Paul McCartney|2342
John Lennon|2134
George Harrison|4432
Ringo Starr|9876


Justin C, by the sea.

Re: CGI table tidy layout possible?

Quoted text here. Click to load it

Very sorry to have wasted peoples' time. I've found the solution, I
wasn't searching on the correct words. Quoting

"To get pretty-printed output, please use CGI::Pretty..."


Justin C, by the sea.

Site Timeline