WDT> However, now I have a problem with execution efficiency.  With the last
WDT> format (format B), whether or not I actually print, the methods to_s of
WDT> obj1, ..., obj1000 are called.  The methods to_s themselves may be very
WDT> complicated.  In the first format (format A), the methods to_s are not
WDT> called at all if @debugging is equal to false.

Why do you call print_info with the string representations of the
variables?  Why not just call it with the variables themselves and
have print_info call the to_s if needed?  Or am I missing something?

This is what I mean:
class A
  attr_accessor(:debug)

  def initialize
    @debug = false
  end

  def print_info(*text)
    puts "in print_info"
    if @debug
      puts text.join(" ")
    end
  end
end

class B
  def to_s
    puts "My to_s has been called!"
    "my to_s"
  end
end

if __FILE__ == $0

  a = A.new
  b1 = B.new
  b2 = B.new

  a.print_info(b1,b2)
  puts "======"
  a.debug=true
  a.print_info(b1,b2)
  puts "======"
  a.debug = false
  a.print_info(b1,b2)
end

=======================
%./junk.rb
in print_info
======
in print_info
My to_s has been called!
My to_s has been called!
my to_s my to_s
======
in print_info

Also, to get rid of that @debug check, you could use the "evil eval"
to create different print_info's in the method debug=(flag)

regards,
-joe