#test 1
$s ="This is a test";
$d =" ";
print "--- output 1 --- \n";
@ar = split($d, $s);
foreach $i (@ar) {
print "|$i| \n";
}
#test 2
#how come this one prints differently?
print "--- output 2 --- \n";
@ar = split(" ", $s);
foreach $i (@ar) {
print "|$i| \n";
}
####
--- output 1 ---
|this|
||
||
|is|
||
||
|a|
||
||
||
|test|
####
--- output 2 ---
|this|
|is|
|a|
|test|