Commit | Line | Data |
---|---|---|
8d063cd8 LW |
1 | #!./perl |
2 | ||
2e1b3b7e | 3 | # $Header: op.split,v 1.0.1.1 88/02/02 11:26:37 root Exp $ |
8d063cd8 | 4 | |
2e1b3b7e | 5 | print "1..6\n"; |
8d063cd8 LW |
6 | |
7 | $FS = ':'; | |
8 | ||
9 | $_ = 'a:b:c'; | |
10 | ||
11 | ($a,$b,$c) = split($FS,$_); | |
12 | ||
13 | if (join(';',$a,$b,$c) eq 'a;b;c') {print "ok 1\n";} else {print "not ok 1\n";} | |
14 | ||
15 | @ary = split(/:b:/); | |
16 | if (join("$_",@ary) eq 'aa:b:cc') {print "ok 2\n";} else {print "not ok 2\n";} | |
17 | ||
18 | $_ = "abc\n"; | |
19 | @ary = split(//); | |
20 | if (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(/:/); | |
24 | if (join(".",@ary) eq "a.b.c") {print "ok 4\n";} else {print "not ok 4\n";} | |
2e1b3b7e KK |
25 | |
26 | $_ = join(':',split(' ',' a b c ')); | |
27 | if ($_ eq 'a:b:c') {print "ok 5\n";} else {print "not ok 5\n";} | |
28 | ||
29 | $_ = join(':',split(/ */,"foo bar bie\tdoll")); | |
30 | if ($_ 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";} |