My little CGI script is acting up again. This time, when it is supposed to check the value of a query (in this case, ?content=about) against an array of possible values, it fails by printing out the error page that is is supposed to do only when the value of the parameter "content" does not equal any of the values in the array. In this case, I know that the value supplied is okay, because I ran it on the command line.
Problematic code (I changed the error page to a one-line string):
Any ideas on how to fix?
Problematic code (I changed the error page to a one-line string):
Code:
#!C:/Perl/bin/perl.exe
use CGI;
use HTML::Template;
use File::Slurp;
use strict;
my $query = new CGI;
my $content = $query->param( "content" );
$ENV{DOCUMENT_ROOT} = "C:/Program Files/Apache Software Foundation/Apache2.2";
my @contentvalue = ( "login", "passfnd", "signup", "services", "compare", "capabilities",
"sc", "wc", "wow", "halo", "halo2", "gwars", "moreg", "violation",
"billing", "other", "about", "history" );
unless ( $content eq @contentvalue ) { #the problem line
print "Error: Bad value.\n\n"
exit;
}
Any ideas on how to fix?