I suggest you the intensive use of Data::Dumper. It helps you to see the structure of your AoH etc.#!/usr/bin/perl use strict; use warnings; use HTML::Template; # some fruits my $fruits = [ { fruit => "banana", properties => [ {where_from => 'europe', size=> 'small'}, {where_from => 'africa', size=> 'large'}, ] }, { fruit => "apple", properties => [ {where_from => 'asia', size=> 'medium'}, {where_from => 'america', size=> 'large'}, ] }, ]; # and now let's add another fruit push @$fruits, { fruit => 'strawberry'}; # let us add some properties ${fruits}->[2]->{properties} = [ {where_from => 'europe', size=> 'small'}, {where_from => 'new zealand', size=> 'huge'}, ]; my $tmpl = HTML::Template->new( filehandle => \*DATA ); $tmpl->param( fruits => $fruits ); print $tmpl->output; __DATA__ <TMPL_LOOP NAME="fruits"> <table> <tr> <th><TMPL_VAR NAME="fruit"></th> <th></th> </tr> <TMPL_LOOP NAME="properties"> <tr> <td><TMPL_VAR NAME="where_from"></td> <td><TMPL_VAR NAME="size"></td> </tr> </TMPL_LOOP> </table> </TMPL_LOOP>
In reply to Re: Re: Re: Sending data for LOOP in HTML::Template
by neniro
in thread Sending data for LOOP in HTML::Template
by Steny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |