Hi,

I have a snippet of code which

1. asks for a title from user
2. opens a text file of the form :

definition: blah blah blah
incidence: blah yah blah
category: yeah blah tah
..
..

3. puts everything to the left of the : into a hash as the keys, and
everything to the right in as matching values.
4. Outputs it as "Title.htm" file in format I want

My code works for (obviously) the key and value ONLY in the 1 position -
Problem is I can't figure out how to get it to sequentially iterate thru the
whole hash table - should be easy, but I can't make it work... Thanks in
advance !

Here is my code:

p "Enter a title..."
title  = gets.chomp
talks_text = []
dict = {}
IO.foreach("testfile.txt") do
|x|
if
y = /:/.match(x)
y = y.pre_match
z=/:/.match(x)
z = z.post_match
dict[y] = z
end
end
dict.sort

File::open(title + '.htm', 'w') do |f|
 f.puts "<HTML>\n<HEAD><TITLE>" + title + "</TITLE></HEAD>\n<BODY
bgcolor=#FFDEAD>\n"
 f.puts "<CENTER><A NAME=\"page_top\"><H1>" + title + "</H1></A>"
  f.puts "by Charles L. Snyder, MD<BR>\n"
 f.puts "</CENTER>\n<HR>\n"
  f.puts "<A NAME=\"$anchor\"><H2>" + dict.keys[1] + "</H2></A>" +
dict.values[1] + "<BR>"
 f.puts "<CENTER><A HREF=\'javascript:window.history.back()\'>Back</A>&nbsp"
  f.puts "</CENTER>\n<HR>\n"
 end



CLS