> 
> I'm afraid you did not understand how your code works: #puts is the
> method that prints all those newlines.  Before @curnl starts to get
> printed all entries of @prevnl have been iterated and printed already.
>  The + is meaningless since the result isn't used for anything.
> 
> robert

Right I see it now, excuse my n00bism :(   So what is the correct way to 
print all my data in the four columns that I need?

Below is what I'm working with.

Thanks for the help!
Tim

class SktyFut
  attr_reader :acct

  def initialize(filename)
    @acct = File.new(filename, "r")
  end

  def future_data
    @sktylist = Hash.new(0)
    @acct.each do |list|
      office = list[21..23]
      if office == "RPT"
        next
      else
        acctnum = list[24..28]
      end
      lv = list[217..230]
      is_negative = list[215,1] == "-"
      value = lv.to_f/100
      value = -value if is_negative

      # Add vales to hash

      @sktylist[acctnum] += value
    end
    return @sktylist
  end
end

class Calculate
  attr_reader :sktyfuta, :sktyfutb
  def initialize(sktyfuta, sktyfutb)
    @sktyfuta = sktyfuta
    @sktyfutb = sktyfutb
  end

  def data_comp
    @sktyfuta.merge(@sktyfutb) { |key, old_value, new_value| old_value - 
new_value }
  end
  #end
end

class FinalNum
  attr_reader :sktynl
  def initialize(sktynl)
    @sktynl = sktynl
  end

  def numbers
    @nat = Hash.new(0)
    @sktynl.each do |key, value|
      key.to_s
      if key <= "39"
        key = "SKTY" # =>
        @nat[key] += value
      elsif key >="40"
        key = "SKYNY" # =>
        @nat[key] += value
      end
    end
    return @nat
  end
end

class Mailer
  attr_reader :prevnl, :curnl, :finbal
  def initialize(prevnl, curnl, finbal)
    @prevnl = prevnl
    @curnl = curnl
    @finbal = finbal
  end

  def format
    @prevnl.each{ |key, value| puts "#{key}\t #{value}" } + @curnl.each{ 
|key, value| puts "#{value}" }
    # @curnl.each_value{ |value| puts value }
    @finbal.each{ |key, value| puts "#{key} \t #{value}" }
  end
end
Dir.chdir("/Users/twolak")
post = SktyFut.new("SKTYFutBal20080507.txt")
a = post.future_data
postord = a.sort
#postord.each{|key, value| puts "#{key} A value is #{value}"}
pre = SktyFut.new("SKTYFutBal20080506.txt")
b = pre.future_data
preord = b.sort
#preord.each{|key, value| puts "#{key} B value is #{value}"}
data = Calculate.new(a,b)
iteration = data.data_comp
#iteration.sort
#iteration.each{|key, value| puts "#{key} comp equals #{value}" }
sktyfinal = FinalNum.new(iteration)
finumb = sktyfinal.numbers
mail = Mailer.new(postord, preord, finumb)
mailinfo = mail.format



require 'net/smtp'

Net::SMTP.start('mailserver.com', 25) do |smtp|
  smtp.open_message_stream('testmail / mailserver.com', 
['testmail / mailserver.com']) do |f|
    f.puts 'From: testmail / mailserver.com'
    f.puts 'To: testmail / mailserver.com'
    f.puts 'Subject: test message'
    f.puts
    #f.puts mailinfo
    f.puts 'This is a test message.'
  end
end

-- 
Posted via http://www.ruby-forum.com/.