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

Re: 'xor' operator is not a sibling to 'or' and 'and'?

by BillKSmith (Monsignor)
on Dec 18, 2019 at 22:55 UTC ( [id://11110360]=note: print w/replies, xml ) Need Help??


in reply to 'xor' operator is not a sibling to 'or' and 'and'?

These operators are called 'Logical' for a reason. They are meant to return a logical value (true or false). Code that depends on the string or numeric value of the result, which arguments are evaluated, or even in the order in which they are evaluated could fail under a future version of perl. Note that the idiom open ... or die "..."; does depend on the open being done first, but is so common I am sure it will always be supported.
Bill

Replies are listed 'Best First'.
Re^2: 'xor' operator is not a sibling to 'or' and 'and'?
by GrandFather (Saint) on Dec 18, 2019 at 23:29 UTC

    I can't imagine the expression result behavior of Perl's logical operators ever going away. There is a large amount of Perl idiom that bakes in that behavior so huge amounts of code would break if that changed. I'm sure the behavior isn't an accidental result of a weird coding decision, but was fully thought out with a view to allowing nice fall back processing using the logical or operators.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found