im just expecting an output of every time it encounters a tag to create 
an empty hash containing the other fields using the fields as the key

im having trouble getting the code u provided to work can you see my 
errors?

#
#
  require 'getoptlong'

  opts = GetoptLong.new(
    ['--style', '-n', GetoptLong::NO_ARGUMENT ],
    ['--database', '-i', GetoptLong::REQUIRED_ARGUMENT]
  )

  $linecount = 0

  opts.each do |opt, arg|
    case opt
      when '--style'
         require arg
      when '--database'
    end
  end
#
#
#
# process options
#
#
#
  File.open('reference.txt').each do |line|
    if line =~ /^tag:/i
      $linecount += 1
    end
  end
    puts $linecount

  info = {}
  last_tag = nil

  data.each_line{ |line| _, key, data = line.match( /^(\w+): (.+)/ 
).to_a
  next unless key # skip blank lines
  if key == "Tag"
    last_tag = data
    info[ data ] = {}
  else
    info[ last_tag ][ key ] = data
  end
  }
#
#
-- 
Posted via http://www.ruby-forum.com/.