title: Tcl : why the variable does not get increment?
body: <p>What I would like to ask you is, why the following snippet does <em>not</em> increment the variable <code>$times</code> ? </p>
  
  <pre><code>#!/usr/bin/tclsh 
  
  set logging { 
  LC/0/1/CPU0:Jan 27 08:24:17.014 CET: ifmgr[175]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/1/0/33, changed state to Down 
  LC/0/1/CPU0:Jan 27 08:24:17.014 CET: ifmgr[175]: %PKT_INFRA-LINEPROTO-5-UPDOWN : Line protocol on Interface GigabitEthernet0/1/0/33, changed state to Down 
  }
  set times 0
  set records [ split $logging "\n" ] 
  foreach rec $records { 
      puts $rec
      incr $times 1
      puts $times       ;# puts [ incr $times 1 ]
  } 
  </code></pre>
  
  <p>Many thanks.</p>