title: Chef using variables in a array
body: <p>How can you use variables in an array in Chef. I am trying to create multiple folder with an array. However my code does not work:</p>
  
  <p>Code</p>
  
  <pre><code>variable1 = "/var/lib/temp"
  variable2 = "/opt/chef/library"
  
  %w{ #{variable1} #{variable2} }.each do |dir| 
      directory dir do
         owner 'root'
         group 'root'
         mode  '755'
         recursive true
         action :create
      end
  end 
  </code></pre>