perl 3.0 patch #22 patch #19, continued
[p5sagit/p5-mst-13.2.git] / t / op.index
1 #!./perl
2
3 # $Header: op.index,v 3.0 89/10/18 15:29:29 lwall Locked $
4
5 print "1..6\n";
6
7
8 $foo = 'Now is the time for all good men to come to the aid of their country.';
9
10 $first = substr($foo,0,index($foo,'the'));
11 print ($first eq "Now is " ? "ok 1\n" : "not ok 1\n");
12
13 $last = substr($foo,rindex($foo,'the'),100);
14 print ($last eq "their country." ? "ok 2\n" : "not ok 2\n");
15
16 $last = substr($foo,index($foo,'Now'),2);
17 print ($last eq "No" ? "ok 3\n" : "not ok 3\n");
18
19 $last = substr($foo,rindex($foo,'Now'),2);
20 print ($last eq "No" ? "ok 4\n" : "not ok 4\n");
21
22 $last = substr($foo,index($foo,'.'),100);
23 print ($last eq "." ? "ok 5\n" : "not ok 5\n");
24
25 $last = substr($foo,rindex($foo,'.'),100);
26 print ($last eq "." ? "ok 6\n" : "not ok 6\n");