[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / sample / occur.rb
blob5927ebc8891e04b7516aa268bc5c3e8c093d53bc
1 # word occurrence listing
2 # usage: ruby occur.rb file..
3 freq = Hash.new(0)
4 while line = gets()
5   line.scan(/\w+/) do |word|
6     freq[word] += 1
7   end
8 end
10 for word in freq.keys.sort!
11   print word, " -- ", freq[word], "\n"
12 end