@Ronnie danke funktioniert super so :)
mit Data::Dumper muss ich mich noch einwenig anfreunden, hehe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl -w
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTML::Template;
use strict;
my $template = HTML::Template->new(filename => '1.tmpl');
my $cgi = CGI->new();
sub build_selectbox {
my ($l_name, $selected, @options) = @_;
return { $l_name => [ map {
{
selectbox_label => $options[$_],
selectbox_value => $_,
selectbox_selected => $selected == $_ ? 1 : 0,
}
} (0 .. $#options) ] };
}
my @a_array = ('---','Berlin','Wien','Bern');
$template->param( build_selectbox( 'loop_kursort', 3, @a_array ) );
print "Content-Type: text/html; charset=utf-8\n\n", $template->output;