Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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.


Comment on Re^2: Or Operator
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-08-23 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls