repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git]
/
sample
/
occur.rb
blob
4ec6ae479bcd593febb3eabdd4d035da271faa96
1
# word occurrence listing
2
# usege: ruby occur.rb file..
3
freq = Hash.new(0)
4
while line = gets()
5
for word in line.split(/\W+/)
6
freq[word] += 1
7
end
8
end
9
10
for word in freq.keys.sort!
11
print word, " -- ", freq[word], "\n"
12
end