You can use the import_names function of CGI

import_names( 'R' );

print "name = ", $R::name;

This function will import all of the parameters into the namespace provided
as the argument (in this case, R).  If the parameter is multivalued, then
you can use the array form( e.g. @R::name ).  Otherwise, you should use the
scalar form (e.g. $R::name).  If no namespace is given, the function will
use 'Q'.

Good luck!
Tanton
----- Original Message -----
From: "Mariusz" <[EMAIL PROTECTED]>
To: "perl" <[EMAIL PROTECTED]>
Sent: Friday, March 15, 2002 6:23 PM
Subject: param function


hi,
I have a html form with over 100 fields, is there a quick way to assign them
in the way that the scalar name becomes the name of the field and the value
of the field is being assigned to that scalar? I know I can just type it one
by one:
$name = param('name');
$lastname = param('lastname');
$age = param('age'); ...

, but there must a prettier way to do it:) I was thinking:

@keys = param();
foreach $key (@keys){
    my $value = param($key);
}

but that would run through the loop and leave me only with one last pair of
retreived $value = "last_field_from_my_form" that I could refer to later in
my script. However, I need all of the pairs.

Thanks for help.

Mariusz

PS. By the way, this is a great list, you guys are very helpful and newbies
like me really appreciate what you do.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to