Given the above, here's a step by step breakdown of what Perl does.

c: When the code is compiled. r: When the code is run. my @list = x() | (1,2,3); c => my @list = scalar(x()) | scalar(1,2,3); c => my @list = scalar(x()) | scalar(2,3); <<void warn>> c => my @list = scalar(x()) | scalar(3); <<void warn (supressed)>> c => my @list = scalar(x()) | 3; r => my @list = undef | 3; r => my @list = 0 | 3; <<uninit warning>> r => my @list = 3; my @list0 = x() || (1,2,3); c => my @list0 = scalar(x()) || (1,2,3); r => my @list0 = undef || (1,2,3); r => my @list0 = (1,2,3); my @list1 = x() or (1,2,3); c => ( my @list1 = x() ) or (1,2,3); c => ( my @list1 = x() ) or (2,3); <<void warn>> c => ( my @list1 = x() ) or 3; <<void warn (supressed)>> c => my @list1 = x(); <<void warn>> r => my @list1 = (); my @list2 = $c->bbox('all') || (1,2,3); c => my @list2 = scalar($c->bbox('all')) || (1,2,3); r => my @list2 = [ ... ] || (1,2,3); r => my @list2 = [ ... ]; my @list3 = $c->bbox('all') or (1,2,3); c => ( my @list3 = $c->bbox('all') ) or (1,2,3); c => ( my @list3 = $c->bbox('all') ) or (2,3); <<void warn>> c => ( my @list3 = $c->bbox('all') ) or 3; <<void warn (supressed)>> c => my @list3 = $c->bbox('all'); <<void warn>> r => my @list3 = ( ... );

In reply to Re^2: 'or' versus '||' - Unexpected Results by ikegami
in thread 'or' versus '||' - Unexpected Results by cmv

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.