in reply to length of 1's
You need to use chomp after you get each line from the file to remove the newline character