Gunnar Hjalmarsson wrote:
Kiarra Parker wrote:
my $parameters = $cgi->Vars();
get_params($parameters);
sub get_params() {
my %parameters = %{ $_ };
print $cgi->header();
print $cgi->start_html;
my $p;
foreach $p (sort keys(%parameters)) {
print "key: $p value: $parameters{$p}\n";
}
print $cgi->end_html;
}
Besides what Charles and Jeff pointed out, the get_params() function
seems to be redundant.
If you want to have the parameters in a named hash, you can do:
my %param = $cgi->Vars;
for my $p (sort keys %param) {
print "key: $p value: $param{$p}\n";
}
Optionally you can stick with a reference, and access the parameters
directly from it:
my $param = $cgi->Vars;
for my $p (sort keys %$param) {
print "key: $p value: $param->{$p}\n";
}
Thanks all. Actually 'get_params' is just a stub I renamed to make the
question clearer, so I'll keep the function there. However I guess I
will keep the reference as is.
Regards,
Kiarra
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>