How to read each line from a file then store the values to array elements?

The easiest way is to use the DelimitedFiles module from the standard library.

String to number conversion is done via parse(T, str) where T is the desired numeric type, and split(str) splits a string at whitespaces. Those are useful when your input is more noisy and cannot be handled by the standard tools for reading tables.

2 Likes