I have a problem with the overloading of the method to_s for object
instances. The code

a = [1,2,3]

def a.to_s()
  s = ""
  each {|x| s += "-#{x}-" }
  return s
end

puts a
puts a.to_s
print a

will yield the following result:
1
2
3
-1--2--3-
-1--2--3-

My question is, why does Ruby handle "puts" for an array different than
"print"? If I implement the same code for a Hash object the output is the
same for both calls.

Regards,
Elmar