From: Nick Bo [mailto:bornemann1 / nku.edu] 
# ok well now i got a bunch of repetitive arrays and repetitive 
# counts how 
# do i just do 1 array for an instant of the word and then an array for 
# the amount of times it was found in the string. Cause i dont 
# want it to 
# print out like
# 
# bar = 6
# bar = 6
# (... 4 more times)
# 
# and so forth i just want it to do
# bar = 6
# baz = 11
# eggs = 3
# etc...

just keep your code simple.
use the structure that works best in your case.

eg


c:\family\ruby>cat test.doc
bar bar bar bar bar bar
baz baz baz baz baz baz baz baz baz baz baz
eggs eggs eggs
lovely
spam spam spam spam


c:\family\ruby>cat test.rb
h=Hash.new(0)
while line=gets
  line.split.each do |word|
    h[word] += 1
  end
end

h.each do |word, count|
  puts "%s: %d" % [word,count]
end


c:\family\ruby>cat test.doc | ruby test.rb
baz: 11
eggs: 3
bar: 6
spam: 4
lovely: 1