On at least two occasions (but not very many more than that) I've written code like:

if( !$a == !$b ) { #or if( !$x != !$y ) {
and those could now be rewritten:
if( not $a xor $b ) { #or if( $x xor $y ) {
but I don't adopt new Perl features lightly and I haven't written Perl code that wanted that sort of test since I noticed the existance of xor so I've never used xor, just written code where I would have used it had it been available enough at the time.

Though, I actually find the concept of "these two logical expressions are equal" to be more useful/natural than a logical "xor" (not equal) so I'm more likely to want

if( !$a == !$b ) {
than the other case and I'd probably leave that as-is rather than change it to
if( not $a xor $b ) {
because I find the latter harder to understand. So I'd probably rather have an eqv (pronounced "equivalent") over an xor. (:

                - tye

In reply to Re: Anyone use "xor" in conditionals? (yes/no) by tye
in thread Anyone use "xor" in conditionals? by bsb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.