I am reading set of lines from text file. It's laid out like this
kCode %title My Title
kCode %content Hello World
pCode %picture MyVar
I have MyVar defined:
set MyVar fox
set code [lindex $line 0] ;#Set code to retrieve xCode from text file
set morph [lindex $line 2] ;#Set morph to the actual value from text file
With a conditional if statement
if { $code eq "pCode" } {
puts "I found a picture which is $morph" ;#outputs MyVar
}
However, I am struggling to recall the value of the variable defined within the text file.
The closest, I've had is
set animal [eval $$morph] ;#references MyVar value which is fox as previously defined
But I get
invalid command name "fox"
Ultimately, I just want to output or save to a variable "fox" from the defined MyVar but cant seem to find the right combination.
I'm sure this is so simple but .. stuck.