On Mar 23, 8:03 am, - Bob - <uctra...@ultranet.com> wrote:
> Perl newbie question:
>
> I need a little loop that will let me access all of the input
> parameters from an HTML form in a generic way without knowledge of the
> specific variable (html form field) names.
>
> I know how to do this: my $name = (param("name"));
>
> But, when I don't know the field names, how do I access the structure
> of the param's with an index or other non-field-specific technique?
>
> Code snippet appreciated, like I said "newbie"
You don't need a loop for this. But if you really wanted to:
my %value_of;
for my $input (param()) {
$value_of{$input} = param($input);
}
Like I said, you don't need the loop for this, because CGI.pm comes
with a way to generate this hash:
my $value_of_ref = Vars();
Or you could even just import them all into a bunch of package
variables:
import_names('R');
print "$R::name, $R::value, $R::age\n"; #etc
Have another read of
perldoc CGI
There are a lot of options that you may not be aware of yet.
Paul Lalli