#!/usr/bin/perl -w use strict; use DBI; use CGI; my $dbh = DBI->connect('DBI:Pg:funkymonkey;host=some.host.com', 'user','password') or die $DBI::errstr; my $array_ref = $dbh->selectall_arrayref(qq( select * from person order by surname ) ) or die $dbh->errstr; my $cgi = new CGI; print $cgi->dropdown_menu(-name=>'myselect', -values=>$array_ref);