in reply to Re^2: Dynamic menu options
in thread Dynamic menu options

If "pull" corresponds to shift, then yes. You can swap your loop variable to $c (though the only single-letter variables that are generally considered good form are $i, $j, $x, $y and $z) and use a shift to get the array member, which would destroy the array in the process. You could also use indices on the array to the same end.

#!/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 $dmenu="<select name=dropdown>"; my $count = 4; foreach my $c (1 .. $count) { my $accs = shift @acc; $dmenu .= "<OPTION value=$c>$accs</OPTION>"; } $dmenu .= "</select>"; print $dmenu;