Was just checking, seemed to be a problem with splitting by tab (I thought it was a tab delimited file) rather than whitespace, which fixed it and gave the correct number of elements in the array. All working now, apologies for the collection of simple errors, and thanks for everybody's help!