Hello,
A while ago, I submitted a patch against the documentation
for the
split function. It has not been applied, so I'm sending it
again. I'm
afraid the documentation is still a little unclear with this
patch
(at least it is correct), but I don't know how best to
express it.
Father Chrysostomos
On Apr 21, 2007, at 10:25 PM, I wrote:
> This paragraph in perlfunc/split is misleading (and
simply wrong in
> places):
>
> <perlfunc>
> Empty leading (or trailing) fields are produced when
there are
> positive
> width matches at the beginning (or end) of the string;
a zero-width
> match
> at the beginning (or end) of the string does not
produce an empty
> field.
> For example:
>
> print join(':', split(/(?=w)/, 'hi there!'));
>
> produces the output 'h:i :t:h:e:r:e!'.
> </perlfunc>
>
> A zero-width match at the end of a string *does*
produce a null
> field. And since empty trailing fields are only
produced when limit
> is big enough or negative, I think we ought to put a
limit of -1 in
> the examples to illustrate more clearly exactly what
fields are
> produced.
|