in reply to uses of split

Since $string may have leading whitespace, try removing it before the split:
$string =~ s/^\s*//g;
Otherwise, we'll need to see some more code to further understand the problem.