Oh, I see many things have happened here: all the comments were deleted and the question being reopened. Just for reference, the accepted answer in Read a file line by line assigning the value to a variable addresses the problem in a canonical way and should be preferred over the accepted one here.