Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

RE: RE: Ebay, my pager and my dad

by ergowolf (Monk)
on May 01, 2000 at 23:25 UTC ( [id://9833]=note: print w/replies, xml ) Need Help??


in reply to RE: Ebay, my pager and my dad
in thread Ebay, my pager and my dad

This is a good point. I will test it. If my memory is correct you are supposed to use || for numeric expressions and or for words. If I had a vote left today I would give you a point. :)

Replies are listed 'Best First'.
RE: RE: RE: Ebay, my pager and my dad
by turnstep (Parson) on May 01, 2000 at 23:49 UTC

    || and "or" (as well as && and "and") have nothing to do with numeric vs strings. They both are simple tests, the only difference is in their priority: the "words" ("and" and "or") are of a lower priority than the ones a C programmer would know (&& and ||).

    'or' is safer to use in some cases because it almost guarantees that everything to the left of it binds tighter (gets evaluated as a single expresion) and *then* gets tested. It's really on a case by case basis. A good and consistent use of parenthesis can often prevent making such decisions, as it removes the the precedence ambiguity.

RE: RE: RE: Ebay, my pager and my dad
by btrott (Parson) on May 01, 2000 at 23:49 UTC
    Sorry, but your memory is incorrect here. :)

    I think you're probably confusing the difference between or and || with the difference between, say, lt and <. There is no relationship between the two differences.

    or and || act the same (they have the same short-circuit behavior), but or has a much lower precedence--meaning that you can use it after list operators without using parantheses. Read perlop for more details.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-26 00:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found