in reply to Re: XML::Twig - rendering a table of data
in thread XML::Twig - rendering a table of data
#!/usr/bin/perl -- use strict; use warnings; use XML::Twig; my @data = ( { age => 12, weight => 200 }, { age => 22, weight => 100 } ); my $table = XML::Twig::Elt->new('table'); $table->insert_new_elt( 'last_child' => 'tr' => ( map { $table->new( # XML::Twig::Elt 'td', $_ ) } @{$_}{ 'age', 'weight' } ), ) for @data; $table->print('record_c'); __END__ <table> <tr><td>12</td><td>200</td></tr> <tr><td>22</td><td>100</td></tr> </table>
|
---|