This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 2.0 patch 1: removed redundant debugging code in regexp.c
[perl5.git] / t / op.split
CommitLineData
8d063cd8
LW
1#!./perl
2
378cc40b 3# $Header: op.split,v 2.0 88/06/05 00:14:37 root Exp $
8d063cd8 4
378cc40b 5print "1..7\n";
8d063cd8
LW
6
7$FS = ':';
8
9$_ = 'a:b:c';
10
11($a,$b,$c) = split($FS,$_);
12
13if (join(';',$a,$b,$c) eq 'a;b;c') {print "ok 1\n";} else {print "not ok 1\n";}
14
15@ary = split(/:b:/);
16if (join("$_",@ary) eq 'aa:b:cc') {print "ok 2\n";} else {print "not ok 2\n";}
17
18$_ = "abc\n";
19@ary = split(//);
20if (join(".",@ary) eq "a.b.c.\n") {print "ok 3\n";} else {print "not ok 3\n";}
21
22$_ = "a:b:c::::";
23@ary = split(/:/);
24if (join(".",@ary) eq "a.b.c") {print "ok 4\n";} else {print "not ok 4\n";}
2e1b3b7e 25
378cc40b
LW
26$_ = join(':',split(' '," a b\tc \t d "));
27if ($_ eq 'a:b:c:d') {print "ok 5\n";} else {print "not ok 5 #$_#\n";}
2e1b3b7e
KK
28
29$_ = join(':',split(/ */,"foo bar bie\tdoll"));
30if ($_ eq "f:o:o:b:a:r:b:i:e:\t:d:o:l:l")
31 {print "ok 6\n";} else {print "not ok 6\n";}
378cc40b
LW
32
33$_ = join(':', 'foo', split(/ /,'a b c'), 'bar');
34if ($_ eq "foo:a:b::c:bar") {print "ok 7\n";} else {print "not ok 7 $_\n";}
35