#!/usr/bin/perl

# import module
use dTemplate;

# read template file
$template = dTemplate->new(file => "../htdocs/templates/form.tmpl");

# option list - array
@countries = ("Australia", "New Zealand", "Japan", "Singapore", "China", "India", "Malaysia", "Thailand"); 

# parse template and replace variables
# write a function to generate <option>s from the array $output = $template->parse(OPTIONS => sub {
				foreach $c (@countries) {
					$ret .= "<option>$c</option>\n";
				}
				return $ret;
			});

# print rendered version
print "Content-Type: text/html\n\n";
print $output;