The array at the LHS of an assignment is actually enforcing list context [1], but the comma is not part of the RHS because of precedence. That's why in @y = 9, 8, 7, 6;
the commas are actually in void context.
Ikegami and others already explained this.
But to answer your main question:
I suspect that I just don't truly understand what it "evaluate in list context" means, precisely...
Yes I have to admit that's a bit confusing here.
For better understanding, here an example where you can see the effect of the three main contexts in Perl on a literal comma separated list.
use strict;
use warnings;
use Carp;
sub ctxt {
my $wa = wantarray // 2;
carp (("SCALAR","LIST","VOID")[$wa]);
}
sub commas {
return "A","B","C","D"
}
my @arr;
# --- List context
@arr = ctxt();
@arr = commas();
warn "<@arr>";
# --- Scalar context
@arr = scalar ctxt();
@arr = scalar commas();
warn "<@arr>";
# --- Void context
ctxt();
commas();
LIST at d:/Perl/pm/context.pl line 8.
main::ctxt() called at d:/Perl/pm/context.pl line 19
<A B C D> at d:/Perl/pm/context.pl line 21.
SCALAR at d:/Perl/pm/context.pl line 8.
main::ctxt() called at d:/Perl/pm/context.pl line 24
<D> at d:/Perl/pm/context.pl line 26.
VOID at d:/Perl/pm/context.pl line 8.
main::ctxt() called at d:/Perl/pm/context.pl line 29
The callers context propagates to the return of a sub-routine, that's why you see the complete LIST in list-context and only the last element when the scalar comma operator is used.
ctxt() is just a helper function I hacked, which you can use to find out which context you are dealing with in the future.
HTH! :)
- it literally compiles to a list-assigment operator