Created
October 30, 2012 23:43
-
-
Save moosan63/3983851 to your computer and use it in GitHub Desktop.
word counting program written by ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = 0 | |
open (ARGV[0]) do |file| | |
while l = file.gets | |
l = l.chomp | |
puts l | |
words += l.size | |
end | |
end | |
puts "\n"+words.to_s + "words" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment