On Monday, April 8, 2002, at 12:15 PM, Randal L. Schwartz wrote:
>>>>>> "Chas" == Chas Owens <[EMAIL PROTECTED]> writes: > > 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. > > Chas> Yes, you are right, that was a slip of the keyboard, I meant that > to say > Chas> array instead of list. But I must ask if you are being purposefully > Chas> obtuse. The list assignment operator forces wantarray to to return > true > Chas> which is what most people would want a mythical array() function > for in > Chas> the first place, hence my -- again I stress -- _reading_ of () as > Chas> array(). I am not claiming that it _is_ array(), but that I find it > Chas> helpful to _think of it as_ array() in this context. > > No, it's not working that way. It works because of two steps here. > The operator > > ($list, $of, $things) = LIST_CONTEXT > > forces its right side to list context. Thus, you get the list > behavior of /\s/g and it spits out all the matches. > > Next, the scalar value of the list assignment operator is the number > of items copied across. But this is because of the property of a list > assignment operator in a scalar context. It's not a list in a scalar > context. > > At no point do you have an "array" in a scalar context, or a "list" > in a scalar context. Really. You don't. Ever. Get it? > > And why I'm harping on this is that I've seen this myth continue to > perpetuate, started from some bad verbage or bad understanding > somewhere, and I'm trying to root it out so that it doesn't keep > spreading like a bad meme. > > -- > 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! oooh. i get it. i thought you were overboard, too - until that last go around. you are right. it is subtle, but important. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]