You may like:
use strict; use warnings; use HTML::Template; my $template = HTML::Template->new (arrayref => [<DATA>]); my @cities = ("Seattle", "Odense", "Venice", "Lewes", "Olso"); $template->param (SelectCity => [map {{City => $_}} @cities]); print $template->output(); __DATA__ <html> <head><title>Test Select</title> <body> <select> <TMPL_LOOP NAME="SelectCity"><option value="<TMPL_VAR NAME=City>"> +<TMPL_VAR NAME=City></option> </TMPL_LOOP> </select> </body> </html>
Prints:
<html> <head><title>Test Select</title> <body> <select> <option value="Seattle">Seattle</option> <option value="Odense">Odense</option> <option value="Venice">Venice</option> <option value="Lewes">Lewes</option> <option value="Olso">Olso</option> </select> </body> </html>
BTW, I strongly recommend that you use strictures (use strict; use warnings;).
In reply to Re: Select form Hell!
by GrandFather
in thread Select form Hell!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |