if from your snippet shows that that there's a space in the split
@temp=split / /, $string;
instead of
@temp=split //, $string;
maybe what he wanted to do is to count number of words in the string.. which can also be done like this
$ths = "this is a string";
$i=split(/\s/,$ths);
print $i;