Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Or Operator

by Aristotle (Chancellor)
on Jul 31, 2004 at 19:31 UTC ( #378966=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://378966]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2016-10-25 17:40 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (326 votes). Check out past polls.