C
chutsu
I've got a file that is in two columns, how do I add the second column
up as I read through the file?
Code:
#!/usr/bin/ruby
file = File.open('some_file.txt')
# Going through each line
file.each do |line|
data = line.split("\t")
total += data[1] # How do I make this line work?
end
puts total
up as I read through the file?
Code:
#!/usr/bin/ruby
file = File.open('some_file.txt')
# Going through each line
file.each do |line|
data = line.split("\t")
total += data[1] # How do I make this line work?
end
puts total