Re: Using undef to ignore values returned from split
authorHugo van der Sanden <hv@crypt.compulink.co.uk>
Wed, 11 Jun 1997 00:00:00 +0000 (12:00 +1200)
committerTim Bunce <Tim.Bunce@ig.co.uk>
Wed, 11 Jun 1997 00:00:00 +0000 (12:00 +1200)
t/op/split.t

index 90bb4365502b91c45aa9e7e0ac6d2f32fda3bb28..b449ba96fa1a7707716dad6b5f6b110d812a5ebd 100755 (executable)
@@ -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";
+}