The error you are seeing usually means that you are referencing a non-existing element of an array. Just for debugging add the lines below right after the split to see if both elements actually contain any data.

 Code:
For each $a in $data
  ?$a
Next
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.