develooper Front page | perl.perl5.porters | Postings from January 2019

Re: [perl #133781] Clarify DOC for split. Section about splittingempty string

Thread Previous
From:
Dan Book
Date:
January 19, 2019 05:26
Subject:
Re: [perl #133781] Clarify DOC for split. Section about splittingempty string
Message ID:
CABMkAVVJuyMxyrwku5+Ga3ZK-_L30jsy4GbScVq3LEV-3hVB0A@mail.gmail.com
On Fri, Jan 18, 2019 at 10:36 PM KES (via RT) <perlbug-followup@perl.org>
wrote:

> # New Ticket Created by  KES
> # Please include the string:  [perl #133781]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=133781 >
>
>
> Hi.
>
> >Note that splitting an EXPR that evaluates to the empty string always
> produces zero fields, regardless of the LIMIT specified.
>
> Please clarify what 'zero fields' mean. Is this empty string or undefined
> value?
>
> print map{ defined? "YES" :"NO"} split('b', "bd"); # YESYES
>
> print map{ defined? "YES" :"NO"} split('b', "b"); # NOTHING IS PRINTED
>
> print map{ defined? "YES" :"NO"} split('b', ""); # NOTHING IS PRINTED
>
>
> would it be better to say:
>
> >Note that splitting an EXPR that evaluates to the empty string does not
> produce fields at all, regardless of the LIMIT specified.
>
>
The number of fields is the number of returned list elements. Thus zero
fields is an empty list.

-Dan

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About