in reply to How to use cgi table in newindex.pm perl
Have a look at a templating engine like Template::Toolkit, or perhaps HTML::Tiny:
use warnings; use strict; use HTML::Tiny; my $hashref = { 'Adam' => 'Eve', 'Clyde' => 'Bonnie', }; my $h = HTML::Tiny->new; print $h->table( [ $h->tr( [ $h->th( 'Foo', 'Bar' ) ], map( { [ $h->td( $_, $hashref->{$_} ) ] } sort keys %$hashref ) ) ] ); __END__ <table><tr><th>Foo</th><th>Bar</th></tr> <tr><td>Adam</td><td>Eve</td></tr> <tr><td>Clyde</td><td>Bonnie</td></tr> </table>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to use cgi table in index.pm perl
by Tabish (Acolyte) on Dec 13, 2017 at 11:11 UTC | |
by haukex (Archbishop) on Dec 13, 2017 at 11:24 UTC | |
by Tabish (Acolyte) on Dec 13, 2017 at 12:13 UTC | |
by haukex (Archbishop) on Dec 13, 2017 at 12:38 UTC | |
by poj (Abbot) on Dec 13, 2017 at 15:54 UTC | |
by Anonymous Monk on Dec 19, 2017 at 00:35 UTC |