Re: String Literals, take 3
[email protected] ("Joseph F. Ryan") Thu, 05 Dec 2002 15:17:57 -0500
| Newsgroups | perl.perl6.documentation |
|---|---|
| Message-ID | <[email protected]> |
Drew Folta wrote:
>>=head3 <<>>; expanding a string as a list.
>>
>>A set of braces is a special op that evaluates into the list of words
>>contained, using whitespace as the delimeter. It is similar to qw[]
>>from perl5, and can be thought of as roughly equivalent to:
>>C<< "STRING".split(' ') >>
>>
>>
>
>Hmm... should we mention the rough equivalence, or the technically correct
>equivalence (which would be c<< "STRING".split(rx/\s+/) >>). The answer
>to that question is the answer to this question: what is the scope of
>this document? Is it for newbies (or p5 converts) or is it a language
>reference (as I read mentioned somewhere else).
>
Again, C<< "STRING".split(' ') >> is different than
C<< "STRING".split(/\s+/) >>. The latter will add an empty element to
the beginning of the string if there is leading whitespace, which is
not the behaivor <<>> will have (if it acts like qw(), at any rate.)