Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Answer: Input arrays to CGI

( #179539=categorized answer: print w/ replies, xml ) Need Help??

Q&A > CGI programming > Input arrays to CGI contributed by jeffa

CGI.pm will handle this. All you need to do is request the multi-value parameter as a list:
use strict; use CGI qw(param); use Data::Dumper; my @list = param('list'); print Dumper \@list;
Run this on the command line like so:
./foo.pl 'list=foo&list=bar&list=baz&list=qux'
and you should see the following:
$VAR1 = [ 'foo', 'bar', 'baz', 'qux' ];

Comment on Answer: Input arrays to CGI
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2015-03-31 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When putting a smiley right before a closing parenthesis, do you:









    Results (673 votes), past polls