Yes, do not attempt to read from $ENV{'QUERY_STRING'} if it is not defined. Change that line to:
if (defined $ENV{'QUERY_STRING'}) {
# assign to variable
# check for login parameter
}
I'd like to echo davorg's update, though, and suggest you use CGI.pm instead:
use CGI;
my $q = CGI->new();
my $age = $q->param('age');
my $login = $q->param('login');
if ($age) {
# do whatever
}
if ($login) {
# do whatever
}
With a mighty WHOMP!, these visible warnings (and several invisible problems probably lurking in your CGI parser) will automagically disappear. |