From: Hugo van der Sanden Date: Wed, 11 Jun 1997 00:00:00 +0000 (+1200) Subject: Re: Using undef to ignore values returned from split X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1fa4fd353846cf20c57c566e2cc3df9b041857d;p=p5sagit%2Fp5-mst-13.2.git Re: Using undef to ignore values returned from split --- diff --git a/t/op/split.t b/t/op/split.t index 90bb436..b449ba9 100755 --- a/t/op/split.t +++ b/t/op/split.t @@ -2,7 +2,7 @@ # $RCSfile: split.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:26 $ -print "1..14\n"; +print "1..16\n"; $FS = ':'; @@ -66,3 +66,13 @@ print $_ eq "1|-|10||20" ? "ok 13\n" : "not ok 13\n"; # do subpatterns generate additional fields (with a limit)? $_ = join '|', split(/,|(-)/, "1-10,20,,,", 10); print $_ eq "1|-|10||20||||||" ? "ok 14\n" : "not ok 14\n"; + +# is the 'two undefs' bug fixed? +(undef, $a, undef, $b) = qw(1 2 3 4); +print "$a|$b" eq "2|4" ? "ok 15\n" : "not ok 15\n"; + +# .. even for locals? +{ + local(undef, $a, undef, $b) = qw(1 2 3 4); + print "$a|$b" eq "2|4" ? "ok 16\n" : "not ok 16\n"; +}