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:produce the output 'h:i: :t:h:e:r:e:!:' and 'hi:there:', respectively, both with an empty trailing field.print join(':', split(//, 'hi there!', -1)), "\n"; print join(':', split(/\W/, 'hi there!', -1)), "\n";
You should definitely open a bug report against perlfunc.pod.
In reply to Re: Function Split, bug or error in the documentation?
by haukex
in thread Function Split, bug or error in the documentation?
by bojinlund
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |