perl 4.0 patch 9: patch #4, continued
[p5sagit/p5-mst-13.2.git] / t / op / chop.t
CommitLineData
8d063cd8 1#!./perl
2
fe14fcc3 3# $Header: chop.t,v 4.0 91/03/20 01:51:42 lwall Locked $
8d063cd8 4
a687059c 5print "1..4\n";
8d063cd8 6
7# optimized
8
9$_ = 'abc';
10$c = do foo();
a687059c 11if ($c . $_ eq 'cab') {print "ok 1\n";} else {print "not ok 1 $c$_\n";}
8d063cd8 12
13# unoptimized
14
15$_ = 'abc';
16$c = chop($_);
17if ($c . $_ eq 'cab') {print "ok 2\n";} else {print "not ok 2\n";}
18
19sub foo {
20 chop;
21}
a687059c 22
23@foo = ("hi \n","there\n","!\n");
24@bar = @foo;
25chop(@bar);
26print join('',@bar) eq 'hi there!' ? "ok 3\n" : "not ok 3\n";
27
28$foo = "\n";
29chop($foo,@foo);
30print join('',$foo,@foo) eq 'hi there!' ? "ok 4\n" : "not ok 4\n";