Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2015-07-28 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (257 votes), past polls