>>>>> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes:
>> There is no meaning for "list in a scalar context", so your statement
>> makes no sense.
Chas> my $some_scalar = () = /\s/g;
Chas> I emphasize again, that is how I _read_ it. I know that there is no
Chas> array() and I know why, but that doesn't change how I read things. This
Chas> hack forces the far left hand bit to return as a list (by making
Chas> wantarray return true) which then gets evaluated in scalar context,
No, that's what I'm saying CANNOT EXIST.
You cannot have a list in a scalar context.
You have an array name, or a comma operator, or a list assignment
operator, or grep, or a slice, or ... , in a scalar context. But
NONE OF THOSE GENERATE A LIST IN A SCALAR CONTEXT.
Chas> that
Chas> is what I would want array() for so I simply read () (when used as
Chas> above) as array().
What you are doing here by adding the () is replacing the right side
of a scalar assignment with a list assignment instead of the bare
operator.
It is this *list assignment* operator when evaluated in a scalar
context that returns a single value... defined as the number of
elements present on the right. But if "list assignment operator in a
scalar context" had been defined by Larry to be "return last value",
like a slice, you'd be hosed. Of course, that'd break the idiom
while (($k, $v) = each %foo) { ... }
for the first false $v, but it'd still mostly work. :)
THERE IS NEVER A LIST IN A SCALAR CONTEXT.
Get it?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]