in reply to need to increment a $scalar while inside for loop

Adding to the above, please use CGI.pm to make your life a lot easier! And avoid the references - strict will not be happy and it's easy for typos to creep in.

Although you don't explain, I assume you want to be able to read the variables for processing afterwards, so using CGI.pm, here's an example snippet:

my $q = new CGI; # let's assume the values creating the option html of $fname # are stored in the array @fnames, and that the values 'GUEST' # and 'Select a member' have been 'push'd onto the end. for (0..$elements) { $name_menu{$_} = $q->scrolling_list(-name => "M$_", -values=>[@fnames], -default=>['Select a member'], -size=>1 ); }
Later, when it comes to accessing the variables sent from the form, transfer them to a hash:
my $i=0; my %M; while (my $val = $q->param("M$i") ) { $M{$i} = $val; $i++; }

Then all Mi elements are accessable as $M{i}

Hope this is useful.

cLive ;-)