in reply to How to check CGI params in if/elsif
If you mean you have a vector of domain names stuffed in a directory, you can (lazily) do something like:
Where I cached $siteid to avoid a function call per comparison in the grep block.my $siteid=$q->param('siteid'); if(!$siteid) { #complain } elsif(grep {$siteid eq $_} @directory) { # taken } else { mkdir 0755 $siteid or warn("Foo: $!") push @directory, $siteid; # or whatever }
Cheers,
alf
|
|---|