develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [ID 20010827.004] qw// documentation says a list is created

Thread Previous | Thread Next
Ren Maddox
August 27, 2001 15:24
Re: [ID 20010827.004] qw// documentation says a list is created
Message ID:
On Mon, 27 Aug 2001, wrote:

> On Mon, Aug 27, 2001 at 10:29:46AM -0500, Ren Maddox wrote:
>> The documentation of qw// states that a list is created.  It needs
>> to be reworded in terms of context.  Here's one attempt:
>>        qw/STRING/
>>                Evaluates to a sequence of comma-separated,
>>                single-quoted sub-strings extracted out of STRING,
>>                using embedded whitespace as the delimiters.
> I'm with Ronald.  The original description was better.

Yes -- I'm not happy with this sentence either.  I was hoping for some
discussion of improvements.

>>                In list context, it can be understood as being
>>                roughly equivalent to:
>>                    split(' ', q/STRING/, -1);
>>                the difference being that it happens at compile
>>                time.
>>                In scalar context, it evaluates to the final
>>                sub-string of the sequence.
> That's actually what a list does in scalar context (as opposed to an
> array, which returns it's number of elements.)  Commonly confused.
> The clarification is good, especially since split() doesn't behave
> that way.

Except that the original point of this change is that there is no such
thing as a list in scalar context.

Ren Maddox

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About