http://qs321.pair.com?node_id=11120144


in reply to Split fake, an emulation of split

I found an error in the documentation of split

No you didn't. As documented, trailing empty fields are only removed when the third operand is zero (the default).

Replies are listed 'Best First'.
Re^2: Split fake, an emulation of split
by bojinlund (Monsignor) on Jul 31, 2020 at 14:59 UTC
    use strict; use warnings; use 5.010; # From https://perldoc.perl.org/5.30.1/functions/split.html: # and each of these: print join(':', split(//, 'abc', 3)), "\n"; print join(':', split(//, 'abc', 4)), "\n"; # produces the output a:b:c __DATA__ Output: a:b:c a:b:c:

      ah yes. You weren't very clear, so I misunderstood what you meant. That is indeed a documentation bug. Did you report it?

        You weren't very clear I didnt read the thred
Re^2: Split fake, an emulation of split
by jo37 (Deacon) on Jul 31, 2020 at 16:50 UTC

    If something behaves differently from its documentation, then it is either an implementation or a documentation error. The discrepancy between actual behaviour and documentation is a fact, as the example is taken straight from split.

    Greetings,
    -jo

    $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$