title: unable to call proc in TCL Invalid command name
body: <p>I'm probably missing something obvious here but maybe you can help me.</p>
  
  <p>I have a tcl script. Here it is in its entirety:</p>
  
  <pre><code>puts [encodeSDR 25]
  
  proc encodeSDR {input} {
    set sdr "test"
  
    return $sdr
  }
  </code></pre>
  
  <p>when I run this script I get an error:</p>
  
  <pre><code>c:\temp&gt;tclsh testenviro.tcl
  invalid command name "encodeSDR"
    while executing 
  "encodeSDR"
    invoke from within
  "puts [encodeSDR 25]"
    (file "testenviro.tcl" line 1)
  </code></pre>
  
  <p>What am I missing? Seems like this should work perfectly. </p>
  
  <p>PS. Found possible reason:</p>
  
  <p>There when I put the puts call below the proc it worked - so does it not load the entire script first? seems weird if that's the case but maybe thats it.</p>