Heres a script that demonstrates what I think you want.
JD
#!/usr/bin/perl
use CGI qw/:standard/; #CGI is installed by default usually.
$query=new CGI; # create a new cgi object
print $query->header; # print the content header
%namepair=undef; # this is a perl hash.. will use $namepair below.
#an html form to show it works
print '
';
if ($query->param()) { #param what CGI holds the POST/Get data in
@names = $query->param; #load the names into an array
for ($i=0;$i<@names;$i++){
#load the names/values into an associative array
print $names[$i]."
";
$namepair{$names[$i]}=$query->param($names[$i]);
}
#show it actually worked:
for ($i=0;$i<@names;$i++){
print $names[$i].'='.$namepair{$names[$i]}."
";
}
}
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have a form that uses POST to pass two name/value pairs to a perl
> script. What is the best way to get those name/value pairs into a
> perl array? - --
> Jim
>
> Freedom is worth protecting
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 6.5.8
>
> iQA/AwUBPOQXXSsk3ywszI1FEQI0SgCgt+4CjJaKGA1MSsQv/xO4pFWAEp8AoMp8
> STvZPkqnOPBI/xmPOA/i/8+z
> =flfF
> -----END PGP SIGNATURE-----
> ________________________________________________
> See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't
> post to the list quickly and you use Netscape to write mail.
>
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss