Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Function Split, bug or error in the documentation?

by haukex (Bishop)
on Jun 24, 2020 at 13:08 UTC ( #11118426=note: print w/replies, xml ) Need Help??


in reply to Function Split, bug or error in the documentation?

AFAICT with a quick check, Perl has always behaved as your code shows. It appears this documentation bug was introduced with a rewrite of the split manpage for 5.16 in bd46758. The previous version did not have this issue, it said:

Empty trailing fields, on the other hand, are produced when there is a match at the end of the string (and when LIMIT is given and is not 0), regardless of the length of the match. For example:
print join(':', split(//, 'hi there!', -1)), "\n"; print join(':', split(/\W/, 'hi there!', -1)), "\n";
produce the output 'h:i: :t:h:e:r:e:!:' and 'hi:there:', respectively, both with an empty trailing field.

You should definitely open a bug report against perlfunc.pod.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11118426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2020-10-25 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (248 votes). Check out past polls.

    Notices?