title: TCL array: variable isn't array
body: <p>I looked at the other two topics on this and I'm still having issues. Here is part of the code that is causing the problem.</p>
  
  <pre><code>if {[llength $fileList] &gt; 0} {
      set iter 1
      foreach f $fileList {
          puts "Sourcing $f..."
          if {[catch {source $f} rc]} {
              puts "file $f exists but unable to source.\nError message: $rc"
              return 1
          }
          array set dt [list $iter $dtList]
          puts $dt($iter)
          incr iter
      }
  }
  </code></pre>
  
  <p>The line <code>array set dt [list $iter $dtList]</code> is causing the <code>can't read "dt(1)": variable isn't array</code> error to appear. Each file that I source creates a list named <code>dtList</code> and I am simply trying to loop through each file, set the <code>$dtList</code> list to another one (an array called <code>dt</code> here), and then later on concat these to create a full list.</p>
  
  <p>I have also tried using <code>set dt($iter) $dtList</code> and the same error is appearing.</p>
  
  <p>I feel like I am missing something extremely simple here but nothing I've tried is working.</p>