Andrew Gaffney [mailto:[EMAIL PROTECTED] : : I have a Perl script which uses the CGI module which needs to : be able to get all the : selected items in a SELECT. I see that the request comes in as : 'selectname=item1&selectname=item2&selectname=item3'. If I do : '$p = $cgi->Vars', wouldn't : I only get the last value?
In a quick test, I get a hash reference:
#!/usr/bin/perl
use strict; use warnings; use Data::Dumper 'Dumper';
use CGI; my $cgi = CGI->new( \*DATA );
my $p = $cgi->Vars;
print Dumper \$p;
__END__ selectname=item1 selectname=item2 selectname=item3
prints: $VAR1 = \{ 'selectname' => 'item1 item2 item3' };
Why use $cgi->Vars?
Because the script is passed a lot of values besides the SELECT values. It's much easier to do 'print $p->{param1}' than '$param1 = $cgi->param('param1'); print $param1'.
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>