in reply to list context

Do the parentheses around $x do anything?

Yes, they make a single-element list.

It seems to me that the rhs will always be a scalar...

It will, because the high-precedence or operator (||) imposes scalar context on its operands and evaluates to a scalar.

Consider, however, the difference between:

my $x = @some_array; my ($y) = @some_array;

The lvalue parentheses are significant.

Replies are listed 'Best First'.
Re^2: list context
by ikegami (Patriarch) on Dec 07, 2010 at 00:06 UTC

    It will, because the high-precedence or operator (||) imposes scalar context on its operands and evaluates to a scalar.

    Only on the LHS.

    use feature qw( say ); my @s = 0 || scalar('a','b','c'); my @l = 0 || ('a','b','c'); say for @s; say "---"; say for @l;
    c --- a b c

      In this case yes (I was too hasty in my explanation). The operator passes along the context in which it appears to its rhs expression.