Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: accessing random count CGI parameters

by shmem (Chancellor)
on Jun 25, 2007 at 11:05 UTC ( [id://623142]=note: print w/replies, xml ) Need Help??


in reply to accessing random count CGI parameters

First, don't process the QUERY_STRING by hand! Let CGI do that. For instance, parameters might get passed using ';' as a separator rather than '&'. See Ovid's CGI Course for more on that.

That said, the following would do

use CGI; my $q = CGI->new; my @list = map { $q->param('xxx'.$_) } 1 .. $q->param('xxxc'); # values now sequential in @list.

For not duplicating the values into @list, use

foreach my $index (1 .. $q->param('xxxc') ) { my $value = $q->param('xxx' . $index); # now do whatever with the value ... }

If you absolutely want your %INPUT hash, you get it populated with

%INPUT = $q->Vars;

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://623142]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found