Hi, Mariusz, :)

I don't qualify as an expert, but this might do the trick:

my %params;

$params{$_} = param($_) foreach param();

If I understand your code correctly, param() returns a list of all the
possible keys, right?  If so, then the above code should work.  You refer to
the parameters as $param{name} instead of just $name.

I hope that helps, :)

---Jason

> -----Original Message-----
> From: Mariusz [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, March 15, 2002 3:23 PM
> To:   perl
> 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