#!./perl
-# $RCSfile: split.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:26 $
-
-print "1..25\n";
+print "1..28\n";
$FS = ':';
# Does assignment to a list imply split to one more field than that?
if ($^O eq 'MSWin32') { $foo = `.\\perl -D1024 -e "(\$a,\$b) = split;" 2>&1` }
-elsif ($^O eq 'VMS') { $foo = `./perl "-D1024" -e "(\$a,\$b) = split;"` }
+elsif ($^O eq 'VMS') { $foo = `./perl "-D1024" -e "(\$a,\$b) = split;" 2>&1` }
else { $foo = `./perl -D1024 -e '(\$a,\$b) = split;' 2>&1` }
print $foo =~ /DEBUGGING/ || $foo =~ /SV = (VOID|IV\(3\))/ ? "ok 11\n" : "not ok 11\n";
$_ = "a : b :c: d";
@ary = split(/\s*:\s*/);
if (($res = join(".",@ary)) eq "a.b.c.d") {print "ok 25\n";} else {print "not ok 25\n# res=`$res' != `a.b.c.d'\n";}
+
+# use of match result as pattern (!)
+'p:q:r:s' eq join ':', split('abc' =~ /b/, 'p1q1r1s') or print "not ";
+print "ok 26\n";
+
+# /^/ treated as /^/m
+$_ = join ':', split /^/, "ab\ncd\nef\n";
+print "not " if $_ ne "ab\n:cd\n:ef\n";
+print "ok 27\n";
+
+# see if @a = @b = split(...) optimization works
+@list1 = @list2 = split ('p',"a p b c p");
+print "not " if @list1 != @list2 or "@list1" ne "@list2"
+ or @list1 != 2 or "@list1" ne "a b c ";
+print "ok 28\n";