in reply to Table in Perl CGI
This is one of the ways.
#!/usr/bin/perl use strict; use warnings; use CGI; my $cgi = CGI->new; my %tbl = ( one => 1, two => 2, three => 3, four => 4, ); print $cgi->header(), $cgi->start_html("Fruits and colors"), $cgi->table({-border=>1}), $cgi->Tr($cgi->th([" Fruit"," Color"])); foreach my $key (sort keys %tbl) { print $cgi->Tr($cgi->td([$key, $tbl{$key}])); } print $cgi->end_table(); print $cgi->end_html();
|
|---|