in reply to Re: Or Operator
in thread Or Operator
Except that will give you warnings if the page parameter is actually non-existent.
You want to test definedness as well as emptiness.
my $page = $cgi->param( "page" ); unless( defined $page and $page ne "" ){ $page = "login"; }
Of course that's pretty clusmy and contains lots of unnecessary punctuation. Let's use a statement modifier instead:
my $page = $cgi->param("page"); $page = "login" unless defined $page and $page ne "";
Makeshifts last the longest.
|
|---|