One practice is more likely to eventually burn you than the other.

Please correct me if I'm wrong: The important point about choosing between "and/or" vs. "&&/||" involves their differences in precedence relative to other operators (especially the "comma operator"); the classic example (often seen in SoPW questions) being:

open $fh, "<", $filename || die "oops!"; # should use "or" here # (or else put parens around the args for the " +open()" call)
But the "burn" only happens when you use  &&/|| in a context where  and/or would be needed to do the right thing. In contrast, I can't think of any context appropriate for  &&/|| such that  and/or wouldn't serve equally well.

If you can find a context where  &&/|| produce an intended result and replacing them with  and/or produces a different (incorrect) result, that would be remarkably informative (and surprising, I think). NB: No fair making up obfu examples that depend on l-to-r vs. r-to-l differences -- people who get into that kind of trouble need other kinds of help and advice.

I'm guessing that BrowserUK has a similar view, and the reason we're both giving you grief about this is that you seem to be suggesting there are situations where using  and/or should be disfavored or unadvisable, whereas B and I would rather say that the better advice is "when in doubt, use  and/or" (which is what the OP seemed to be doing in the first place).


In reply to Re^4: How to return a two dimensional array from a function in Perl? by graff
in thread How to return a two dimensional array from a function in Perl? by gunners.newark

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.