my %in = $cgi_obj->Vars; # where $cgi_obj is whatever your CGI object is. my $hidden_fields; # This for loop goes through each of the dvdX keys and creates an HTML hidden field for them, appending each to the string of others. $hidden_fields .= $cgi->hidden( $_, $in{$_} ) for ( grep { /dvdX/ } keys %in ); print start_form(-action=>'show.pl'); print table( {border=>1, -width=>'35%', -align=>'center', -style=>'border: ridge lime; color: yellow; font-size: 20', -background=>'../data/images/blue.jpg'}, Tr( {-align=>'center'}, td( 'Movie X' ), td( popup_menu(-name=>'dvdX', -values=>[@tips] )), td( submit( 'Pick' ))), Tr( {-align=>'center'}, td( submit( 'Clear' )), td( submit( 'Done' )))), br(), br(); print table( {border=>1, -width=>'35%', -align=>'center', -style=>'border: ridge lime; color: yellow; font-size: 20', -background=>'../data/images/blue.jpg'}, Tr( {-align=>'center'}, td( submit( 'Add' )), td( submit( 'Show' ))), Tr( {-align=>'center'}, td( submit( 'Modify' )), td( submit( 'Delete' )))); # this is the string that contains all of the generated HTML hidden fields we just made. print $hidden_fields; print end_form(), br(), br();