title: Tcl error in doing sum
body: <p>I want to compute average on a list of numbers stored in a tcl list P. Here's my script : </p>
  
  <pre><code>set sum 0.0
  foreach e $P { set sum [expr {$sum + $e}] }
  set avg [expr {1.0*$sum / [llength $P]}]
  </code></pre>
  
  <p>But I have the error : <code>can't use non-numeric string as operand of "+"</code>
  How can I do the sum ? </p>