# use warnings and use strict are assumed... use CGI; my $q = CGI->new; while(my @options=$sth->fetchrow_array()){ print $q->popup_menu( -name => 'whatever', -values => \@options, -default => $selected, ); }