summaryrefslogtreecommitdiff
path: root/sample/occur2.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/occur2.rb')
-rw-r--r--sample/occur2.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/sample/occur2.rb b/sample/occur2.rb
index b8ecf70..53885c0 100644
--- a/sample/occur2.rb
+++ b/sample/occur2.rb
@@ -2,9 +2,9 @@
# usege: ruby occur2.rb file..
freq = {}
while gets()
- for word in $_.split(/\W+/)
+ for word in split(/\W+/)
begin
- freq[word] = freq[word] + 1
+ freq[word] += 1
rescue NameError
freq[word] = 1
end