diff options
author | Jeff Pinyan <japhy@pobox.com> | 2001-07-27 10:00:37 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-07-29 16:28:45 +0000 |
commit | 6de678708ca27d8ff9604030551fb53b27f5c5be (patch) | |
tree | a26575b52846895de3b65d8cee0b1ca6e83d41b4 /pp.c | |
parent | 0926d669f0aeb90483227aeb54b96aaa4edee0f3 (diff) | |
download | perl-6de678708ca27d8ff9604030551fb53b27f5c5be.tar.gz |
split()'s unused captures should be undef, not ''
Message-ID: <Pine.GSO.4.21.0107271358310.28213-100000@crusoe.crusoe.net>
p4raw-id: //depot/perl@11475
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -4228,12 +4228,16 @@ PP(pp_split) for (i = 1; i <= rx->nparens; i++) { s = rx->startp[i] + orig; m = rx->endp[i] + orig; - if (m && s) { + + /* japhy (07/27/01) -- the (m && s) test doesn't catch + parens that didn't match -- they should be set to + undef, not the empty string */ + if (m >= orig && s >= orig) { dstr = NEWSV(33, m-s); sv_setpvn(dstr, s, m-s); } else - dstr = NEWSV(33, 0); + dstr = &PL_sv_undef; /* undef, not "" */ if (make_mortal) sv_2mortal(dstr); if (do_utf8) |