in reply to Split not working

Note that splitting on / / is different from splitting on " ". The latter splits on any sequence of whitespace and also throws away trailing whitespace. (Splitting on /\s+/ is akin to splitting on " " but gives an empty field if the string starts with whitespace. You can also do /\S+/g instead of split " ".)