TCL has some built-in command.
For example $env(some_env_var)
, I'll take some environment variable.
I use $env(some_env_var)
in proc
proc pc {} {
return $env(NUMBER_OF_PROCESSORS)
}
puts [pc]
then I get error:
$ tclsh ./t.tcl
can't read "env(NUMBER_OF_PROCESSORS)": no such variable
while executing
"return $env(NUMBER_OF_PROCESSORS)"
(procedure "pc" line 2)
invoked from within
"pc"
invoked from within
"puts [pc]"
(file "./t.tcl" line 5)
$env
seems invalid in scope of proc
,
How should I modify $env
to make it valid in the scope of proc
?