Shiloh Madsen wrote:

/ ...

> ..with the last line having changed a number of times. Obviously, I
> haven't been able to get the code to run right. Could anyone tell me
> what I am missing?

------------------------------------------
#!/usr/bin/ruby -w

chapter_list = [
   "Getting Started|1",
   "Numbers|9",
   "Letters|13"
]

cn = 1

line_width = 60

lwd2 = line_width/2

chapter_list.each do |item|
   chapter_name,page_number = item.split("|")
   puts "Chapter #{cn}: #{chapter_name}".ljust(lwd2) +
   "#{page_number}".rjust(lwd2)
   cn += 1
end
------------------------------------------


Output:

Chapter 1: Getting Started                                 1
Chapter 2: Numbers                                         9
Chapter 3: Letters                                        13

-- 
Paul Lutus
http://www.arachnoid.com