diff options
Diffstat (limited to 't/op.chop')
-rw-r--r-- | t/op.chop | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1,14 +1,14 @@ #!./perl -# $Header: op.chop,v 2.0 88/06/05 00:13:22 root Exp $ +# $Header: op.chop,v 3.0 89/10/18 15:28:19 lwall Locked $ -print "1..2\n"; +print "1..4\n"; # optimized $_ = 'abc'; $c = do foo(); -if ($c . $_ eq 'cab') {print "ok 1\n";} else {print "not ok 1\n";} +if ($c . $_ eq 'cab') {print "ok 1\n";} else {print "not ok 1 $c$_\n";} # unoptimized @@ -19,3 +19,12 @@ if ($c . $_ eq 'cab') {print "ok 2\n";} else {print "not ok 2\n";} sub foo { chop; } + +@foo = ("hi \n","there\n","!\n"); +@bar = @foo; +chop(@bar); +print join('',@bar) eq 'hi there!' ? "ok 3\n" : "not ok 3\n"; + +$foo = "\n"; +chop($foo,@foo); +print join('',$foo,@foo) eq 'hi there!' ? "ok 4\n" : "not ok 4\n"; |