We all know that to get some parameters from CGI, you do:
use CGI;
my $cgi = new CGI();
my $param1 = $cgi->param('param1');
my $param2 = $cgi->param('param2');
..
When I have a lot of parameters, copy-pasting the
$cgi-param('..') over and over gets annoying quickly. Back before I put
use strict; in my scripts (about three days ago), I would do the following to overcome this:
@params = ('param1', 'param2', ..);
for $param (@params) {
$$param = $cgi->param($param);
}
However, now that I'm using strict, I can't do this anymore. I get an error that I can't declare a scalar dereference. I see that you can do things like:
my @names = $cgi->param;
or
$cgi->import_names('Q');
They just aren't as convenient as the other method. With the other method, I could get all the variables and then do things like
print "bla bla $param1 bla\n";
But now I would have to do something like
print "bla bla " . $Q::param1 . " bla\n";
I know I'm complaining about something that really doesn't matter too much. I'm just wondering what you monks do when you retrieve a large set of parameters. Although there are a plethora of other threads that deal with getting parameters with CGI.pm, I couldn't find any that answer this question. My apologies if such a thread already exists.
Thanks!