title: Tcl: processing variables in a list
body: <p>Maybe this is pretty stupid, but I really can't find a soulution. I created two variables and want to transform them into lists.
  This commands are tool specific, but they work the way I want:</p>
  
  <pre><code>redirect max_transition {report_constraint -view $pargs(-scenario) -drv_violation_type {max_transition} -all_violators} -variable
  redirect max_capacitance {report_constraint -view $pargs(-scenario) -drv_violation_type {max_capacitance} -all_violators} -variable
  </code></pre>
  
  <p>Now I want to create tcl lists out of them. I could use a loop, because the data has the same structure.</p>
  
  <pre><code>set reports {$max_transition $max_capacitance}
  set report_length [llength $reports]
  
  for {set i 0} {$i &lt; $report_length} {incr i} { 
      set tns_value 0
          set max_wns 0
      set vios 0
  
      set report [lindex $reports $i]
      puts $report
  
      # remove all uneccessary white spaces
      set no_space [regexp -all -inline {\S+} $report]
  
      # insert a new line for every path
      set insert_lines [string map {" U_" \nU_} $no_space]
  
      # create list out of result reports
      set report_list [split $insert_lines "\n"]
  
      if {[llength $report_list] &gt; 1} {
          for {set i 1} {$i &lt; [llength $report_list]} {incr i} {
              # get value of violation
              set slack [lindex [split [lindex $report_list $i] " "] 3]
  
              set tns_value [expr $tns_value + $slack]
              if {$vios == 0} {set max_wns $slack}
              incr vios 
          }
      }
      # write out values
      puts "$pargs(-scenario), $report, $max_wns, $tns_value, $vios"
  }
  </code></pre>
  
  <p>But this does not work out. The loop just puts out the variable's names (because of "puts $report") but not its content.
  If I do it without a loop (so for each variable the same code consecutively), I get the lists I want.
  So how can I process these variables as a whole in a loop?</p>