Well, for starters, you are not structuring your data efficiently. You might take a lesson from the database concept of normalization. In a nutshell, when you are trying to represent more than one value in a variable (in this case, "sons") you should be seeing a red flag, or in Perlish terms, more hashes.
You are probably looking at a loop within a loop, using a more complete structure of an AoHoAoH's (think that's right), the outer loop being the "adults" and the inner loop being the "sons." Also, H::T requires a reference to an AoH for loops. Oh, and one more thing, your keys should be the same in each element of the array--below I show both Wife and Friend in each. Otherwise there's no way for the loop to differentiate between the two in the HTML (no logic available unless you are using H::T::Expr)
my $AoH = [ { 'Lead' => 'fred', 'Wife' => 'wilma', 'Friend' => 'barney', 'Son' => [ { 'name' => 'mike'}, { 'name' => 'jon' }, { 'name' => 'bill'} ], 'No' => '1', }, { 'Lead' => 'george', 'Wife' => 'jane', 'Friend' => 'sam', 'Son' => [ { 'name' => 'elroy'}, { 'name' => 'sam' }, { 'name' => 'bobby'} ], 'No' => '1', } ]; HTML: <tmpl_loop parents> <tmpl_var Lead> <tmpl_var Wife> <tmpl_var Friend> <tmpl_loop Son> <select> <option value="<tmpl_var Name>"><tmpl_var Name></option> </select> </tmpl_loop> </tmpl_loop>
Anyway, see the HTML::Template docs for all the glorious details.
In reply to Re: Pull down menu using HTML::Template
by bradcathey
in thread Pull down menu using HTML::Template
by sara2005
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |