in reply to use constant; RHE of solo confusing in list

All parens do is change precedence.[1]

my @a = ('a', 'b', 'c');
is only written that way because
my @a = 'a', 'b', 'c';
means
( my @a = 'a' ), 'b', 'c';

That's why

my @a = ( 1..4 );

is just a weird way of writing

my @a = 1..4;

That means that

use constant { zed => 0, one => 1, repos => (qw(oss non-oss debug)), two => 2, };

is a weird way of writing

use constant { zed => 0, one => 1, repos => 'oss', 'non-oss' => 'debug', two => 2, };

(Same goes when using repos => @{[qw(oss non-oss debug)]}.)

There's no way to support constants that represent more than one scalar (list use constant FOO => "a", "b";) when passing hash reference because adding support for that would have made the syntax insanely complicated.


  1. Two exceptions:

    • They can affect whether an assignment is a scalar assignment operator or a list assignment operator as described here.

    • () is the stub operator, an expression that evaluates to 0 scalars in list context and undef in scalar context.