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";
    }

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to