On Tue, Jan 17, 2006 at 07:24:14PM +0200, Gaal Yahas wrote:
: While cleaning up tests for release:
:     "".split(':')    =>
:        ()            # Perl 5
:        ("",)         # pugs
: Which is correct? It doesn's seem to be specced yet.

This has nothing to do with splitting on the empty string, per se, but
with Perl 5 stripping trailing null fields by default:

    @results = split(/:/,'::::');
    print @results + 0; # prints '0'

I think we could make that behavior optional now with :trim or some
such.  The original motivation has largely gone away with the advent
of autochomping filehandles, so split /\s+/ won't produce a spurious
null field after the \n.


Reply via email to