- my @a = x() | (1, 2, 3) evaluates x() and (1, 2, 3) in scalar context: x() gives 0 and (1, 2, 3) gives 3; now, the result (a single scalar) is put in a list context, resulting in a single-element list, so you have @a = (3) and it warns you that it threw away the (1, 2); it also warns (later, at runtime) that () in scalar context is undef and you are using an undef where you should be using a number
- my @a = x() || (1, 2, 3) evaluates x() in scalar context and (as x() gives you 0, false) evaluates (1, 2, 3) in list context, so you have @a = (1, 2, 3) and no warnings
- my @a = x() or (1, 2, 3) has different operator precedence; it could be written as (my @a = x()) || (1, 2, 3) -- it evaluates @a = x() in scalar context and (as x() gives you 0, false) evaluates (1, 2, 3) in void context, so the result of the left hand side of the "or" is (1, 2, 3) and it warns about throwing away the 1, 2 and the 3 :-)
- my @a = $c->bbox() || (1, 2, 3) evaluates $c->bbox() in scalar context (but in scalar context, bbox returns an array ref!!!) and does not evaluate (1, 2, 3) (it would, in list context, if the left hand side of the "or" were false), so you have @a = ([51,3,102,55]) and no warnings
- my @a = $c->bbox() or (1, 2, 3) has different operator precedence; it could be written as (my @a = $c->bbox()) || (1, 2, 3) -- it evaluates $c->bbox() in list context, but the whole @a = $c->bbox() in scalar context (the result of said assignment is 4, the lenght of the @a array now), so it will evaluate the (1, 2, 3) in void context, so the result of the left hand side of the "or" is (1, 2, 3) and it warns about throwing away the 1, 2 and the 3 :-)
So, what you really want is:
my @a = $c->bbox();
@a = (1, 2, 3) unless @a;
I don't have 5.10 installed here, so, I can't check if the "//" operator would do the trick for you... HTH!