in reply to Re: Table in Perl CGI
in thread Table in Perl CGI
Thank you for checking out my module, this really is an honor. :) You can simplify a few things, for what it is worth:
use strict; use warnings; use Spreadsheet::HTML qw( portrait ); my %hash = ( kumquat => 'orange', pomegranate => 'red', cherimoya => 'green', lingonberry => 'purple' ); my @data = ( [sort keys %hash], [map $hash{$_}, sort keys %hash] ); print portrait( data => \@data, indent => ' ', th => { style => { background => $data[1] } }, td => { style => { background => $data[1] } }, ); __DATA__ <table> <tr> <th style="background: green">cherimoya</th> <th style="background: orange">kumquat</th> <th style="background: purple">lingonberry</th> <th style="background: red">pomegranate</th> </tr> <tr> <td style="background: green">green</td> <td style="background: orange">orange</td> <td style="background: purple">purple</td> <td style="background: red">red</td> </tr> </table>
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Table in Perl CGI
by 1nickt (Canon) on Aug 06, 2015 at 20:25 UTC |