in reply to Populating a CGI scrolling list from a database

selectall_arrayref returns an array ref of rows, and each row is an array ref again, so it looks like this:

my $doclist = [['prod1'], ['prod2']];

You can remove remove these easily:

my @flat_doclist = map $_->[0], @$doclist; # and then later: print scrolling_list(-name => 'cboProj', -values => \@flat_doclist);

See also: perllol, perldata, perlreftut.

Replies are listed 'Best First'.
Re^2: Populating a CGI scrolling list from a database
by davies (Monsignor) on Feb 15, 2011 at 16:27 UTC

    Thank you, your advice works perfectly. I was misreading the output I'd got from Data::Dumper and not getting the point that I was getting an AoA. Now that I understand your answer, I understand the question I should have been asking myself (I'm sure that 42 comes in here somewhere (-: ).

    Regards,

    John Davies