I'm trying to use a global variable in other proc in tcl.
Here's a short example:
proc myname {} {
set ::name [gets stdin]
}
proc myname2 {} {
puts "your name is: $name"
}
tcl_shell> proc myname
Jhon <--- "Jhon" should be stored in varible called *name*
tcl_shell> proc myname2
your name is Jhon <-- I want something like this.
But I'm still seeing this error: Error: can't read "name": no such variable
I also have tried this:
proc myname {} {
global name
set name [gets stdin]
}
proc myname2 {} {
puts "your name is: $name"
}