Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Or Operator

by beable (Friar)
on Jul 31, 2004 at 01:40 UTC ( #378852=note: print w/ replies, xml ) Need Help??


in reply to Re: Or Operator
in thread Or Operator

I think this is the clearest and most concise way to express it: my $page = $cgi->param("page") || "login"; You might say that inexperienced people won't understand it, but once they see it a few hundred times (because this is a very common way of doing it), they'll probably get it.


Comment on Re^2: Or Operator
Download Code
Replies are listed 'Best First'.
Re^3: Or Operator
by wolv (Monk) on Jul 31, 2004 at 04:49 UTC
    Then again, if there is a chance that $cgi->param("page") will be 0 - and you want to accept that, || will not work correctly. We'll get // (defined-or) in Perl 5.10, fortunately.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-08 02:38 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 (93 votes), past polls