M. J. T. Guy [Mon, 24 Jul 2000 15:32:29 +0000 (16:32 +0100)]
Subject: Re: [PATCH] [ID
20000716.011] strangeness with split($_ =~ m/.../)
Message-Id: <E13GjHR-00058t-00@libra.cus.cam.ac.uk>
p4raw-id: //depot/perl@6432
# the format supported by op/regexp.t. If you want to add a test
# that does fit that format, add it to op/re_tests, not here.
-print "1..213\n";
+print "1..215\n";
BEGIN {
chdir 't' if -d 't';
$a and $a =~ /^Object\sS/ or print "# '$a' \nnot ";
print "ok $test\n";
$test++;
+
+# test result of match used as match (!)
+'a1b' =~ ('xyz' =~ /y/) and $` eq 'a' or print "not ";
+print "ok $test\n";
+$test++;
+
+'a1b' =~ ('xyz' =~ /t/) and $` eq 'a' or print "not ";
+print "ok $test\n";
+$test++;
# $RCSfile: split.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:26 $
-print "1..25\n";
+print "1..26\n";
$FS = ':';
$_ = "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 "no ";
+print "ok 26\n";