title: How to display a variable inside string with Ruby
body: <p>So I have the following code that reads a text file line by line.
  Each line ends with a return carriage. The code below outputs the following:</p>
  
  <pre><code>define host {
      use             servers
      host_name         ["buffy"]
      alias         ["buffy"]
      address       ["buffy"].mydomain.com
  }
  </code></pre>
  
  <p>How do i get rid of the bracket and quotes?</p>
  
  <pre><code>File.open('hosts','r') do |f1|
  
  while line = f1.gets
      data = line.chomp.split("\n")
  
          File.open("nagios_hosts.cfg", "a") do |f|
              f.puts "define host {\n";
              f.puts "\tuse             servers\n"
              f.puts "\thost_name       #{data}"
              f.puts "\talias         #{data}"
              f.puts "\taddress       #{data}.mydomain.com"
              f.puts "\t}\n\n"
          end
      end
  end
  </code></pre>