in reply to Dynamic menu options
#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser set_message); use CGI qw(-oldstyle_urls :standard); print header(); my @acc = qw(12345 67895 123445 112288 3736666 445899); my $c=0; my $dmenu="<select name=dropdown>"; foreach my $accs(@acc) { $c++; $dmenu .= "<OPTION value=$c>$accs</OPTION>"; } $dmenu .= "</select>"; print $dmenu;
Note I have used the concatenating assignment operator .= (see Assignment Operators, Additive Operators).
Update: Copy paste fail fixed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamic menu options
by Anonymous Monk on Jul 28, 2010 at 18:11 UTC | |
by kennethk (Abbot) on Jul 28, 2010 at 18:46 UTC |