mmcw
asked on
Control over input
Hello,
I want to do the following:
$country = "netherlands, nederland, holland, nl";
if ($test = "one of the values of $country) {
$x = 1
}
One of the values can be netherlands or nederland or holland or nl.
$test is an input out of a form.
It must be case insensitive!
So if the input $ test = "Netherlands" it also must work
greeting Michel
I want to do the following:
$country = "netherlands, nederland, holland, nl";
if ($test = "one of the values of $country) {
$x = 1
}
One of the values can be netherlands or nederland or holland or nl.
$test is an input out of a form.
It must be case insensitive!
So if the input $ test = "Netherlands" it also must work
greeting Michel
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Whoops, let's try that again:
my %country = map { ($_, 1) } qw(netherlands nederland holland nl);
$test = "Nl";
my $Found = $country{lc($test)} || 0;
print $Found,"\n";
my %country = map { ($_, 1) } qw(netherlands nederland holland nl);
$test = "Nl";
my $Found = $country{lc($test)} || 0;
print $Found,"\n";
my %country = map { ($_, 1) } qw(netherlands nederland holland nl);
$test = "Nl";
my $Found = $country(lc($test)) || 0;
print $Found,"\n";