title: How do I concatenate 2 variable names into 1 name in TCL?
body: <p>I've got a group of variables that are lists of bytes that I'm trying to search through.   </p>
  
  <pre><code>set foo0 [list 0 1 2]
  set foo1 [list 3 4 5]
  set foo2 [list 6 7 8]
  set fooCount 3
  
  for { set z 0 } { $z&lt;$fooCount} { incr z } { 
      tbf str "foo$z: foo$z"
  }
  </code></pre>
  
  <p>I'd like this to print out:</p>
  
  <pre><code>foo0: 0 1 2
  foo1: 3 4 5
  foo2: 6 7 8
  </code></pre>
  
  <p>But I get:</p>
  
  <pre><code>foo0: foo0
  foo1: foo1
  foo2: foo2
  </code></pre>
  
  <p>I tried changing my print line to </p>
  
  <pre><code>tbf str "foo$z: $foo$z"
  </code></pre>
  
  <p>But then I get an error that there is no variable foo.  I've also tried copying all of the foo variables into a fooList, but again I don't seem to be getting the contents.</p>