Thanks to all who replied (David Moreno Garza, Paul Lallo, and Sean Davis who replied off-list).
Sean very kindly pointed out that I was in fact only one row with my fetchrow_array statement. Paul is correct and [ @studies ] and [EMAIL PROTECTED] are in this instance synonyms. My script now works :D and for reference is included below (in case others are searching for similar solutions). Thanks for your help, Neil #!/usr/bin/perl -w use strict; use CGI; use DBI; ### Initialise a new CGI object my $q = new CGI; ## Define the database connection my $user = "xxxx"; my $dbh = DBI -> connect('DBI:mysql:localhost:database=gdraw;host=localhost;port=3306', $user,'xxxx') || exit; ## Grab the datasets that are available by querying the ## 'studies' table ## ## TODO : Eventially need to make this so that it is base ## on the user's permissions my $statement = 'SELECT study FROM studies'; my $query = $dbh -> prepare($statement); $query -> execute(); print "$query\n"; my @studies; ## Grab all rows from the query and place in the @studies array while(my $study = $query -> fetchrow_array){ push @studies, $study; } ## Print the web-page print $q -> header, $q -> start_html(-title => "gDRAW - Genotype Database, R & Analysis Web-interface", -style => {-src => "/css/gdraw1.css"}), "\n", $q -> h1("Existing Data"), "\n", $q -> p("You can select cohorts, markers and phenotypes to load from below"), "\n", ## Start the form $q -> start_form(-action => "dbselect2.pl", -method => "post", - enctype=>"multipart/form-data"), ## Have a pull-down box for selecting the studies that the ## user can access $q -> popup_menu(-name => 'study_select', -values => [ @studies ], -default => '' -labels => ''), ## End the form $q -> endform, $q -> hr, "\n", $q -> p("<a href=\"\" target=\"\">gDRAW</a> was written by <a href=\"mailto:nshephard \<at\> gmail.com\">Neil Shephard</a>."), "\n", $q -> end_html; exit; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/