1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!./perl
# $Header: op.split,v 1.0.1.1 88/02/02 11:26:37 root Exp $
print "1..6\n";
$FS = ':';
$_ = 'a:b:c';
($a,$b,$c) = split($FS,$_);
if (join(';',$a,$b,$c) eq 'a;b;c') {print "ok 1\n";} else {print "not ok 1\n";}
@ary = split(/:b:/);
if (join("$_",@ary) eq 'aa:b:cc') {print "ok 2\n";} else {print "not ok 2\n";}
$_ = "abc\n";
@ary = split(//);
if (join(".",@ary) eq "a.b.c.\n") {print "ok 3\n";} else {print "not ok 3\n";}
$_ = "a:b:c::::";
@ary = split(/:/);
if (join(".",@ary) eq "a.b.c") {print "ok 4\n";} else {print "not ok 4\n";}
$_ = join(':',split(' ',' a b c '));
if ($_ eq 'a:b:c') {print "ok 5\n";} else {print "not ok 5\n";}
$_ = join(':',split(/ */,"foo bar bie\tdoll"));
if ($_ eq "f:o:o:b:a:r:b:i:e:\t:d:o:l:l")
{print "ok 6\n";} else {print "not ok 6\n";}
|