my $mind = ( \'a\', \'little\', \'confused\' );
And it\'s because perldoc perlfaq4 explains the line above as follows (emphasis added):
It's a matter of terminology and perspective. Terminology is tricky here because you can write a list in source code, return a list of values, or evaluate something in list context.. and the word "list" means something subtly different in each case!
Technically, a list cannot exist in scalar context because perl (the interpreter) does not create a list of values for things like this:
my $x = ('a', 'b', 'c');
When being pedantic precise this is explained as the behavior of the comma operator in scalar context. Similarly, qw
is defined as returning the last element in scalar context so there's no list here, either:
my $x = qw(a b c);
In both of these cases (and for any other operator examples that we could muster up) what we're saying is that the interpreter doesn't create a list of values. That's an implementation detail. There's no reason that perl couldn't create a list of values and throw away all but the last one; it just chooses not to.
Perl the language is abstract. At a source code level ('a', 'b', 'c')
is a list. You can use that list in an expression that imposes scalar context on it, so from that perspective a list can exist in scalar context.
In the end, it's a choice between mental models of how [Pp]erl operates. The "A list in scalar context returns its last value" model is slightly inaccurate but easier to grok. As far as I know there aren't any corner cases where it is functionally incorrect. The "There's no such thing as a list in scalar context" model is more accurate but harder to work with as you need to consider the behavior of every operator in scalar context.