Alright, I fixed the problem with the backslashes, but it's still 
returning an empty file... it shows the output in the command line and 
creates a file now, but it's still empty. :-/


I decided to go ahead and fix the file saving problem first before I 
move on to the other part of it, so here's the original code. The output 
is correct, but something's preventing it from being put into the file 
it creates.



c_list = [
    'Boston',
    'Nashville',
    'San Francisco',
    'Houston',
    'Portland',
    'Atlanta',
    'Chicago',
    'Indianapolis',
    'Charleston'
    ]

bar = '|| '

temp_array = []

  temp_array.push puts bar + c_list[0..2].join(' pets || ') + (' pets 
||'+ "\n")

  temp_array.push puts bar + c_list[3..5].join(' pets || ') + (' pets 
||'+"\n")

  temp_array.push puts bar + c_list[6..8].join(' pets || ') + (' pets 
||'+"\n")


puts 'File completed. Save as..?'
save_as = gets.chomp



File::open("c:\\rubyfiles\\citylist-#{save_as}.txt", 'w') do |f|
  f.write temp_array

end


What am I doing wrong?? :-(
-- 
Posted via http://www.ruby-forum.com/.