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:use CGI; my $cgi = new CGI(); my $param1 = $cgi->param('param1'); my $param2 = $cgi->param('param2'); ..
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:@params = ('param1', 'param2', ..); for $param (@params) { $$param = $cgi->param($param); }
ormy @names = $cgi->param;
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$cgi->import_names('Q');
But now I would have to do something likeprint "bla bla $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.print "bla bla " . $Q::param1 . " bla\n";
In reply to Multiple CGI parameters by sstevens
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |