I have a string in tcl like this:
set hello 0x09
how to get the last part of $hello, like 09 from it?
You could evaluate the string in a slave interpreter, and rely on the fact that the set command returns its value:
set cmd {set hello 0x09}
set i [interp create -safe]
set value [interp eval $i $cmd]
puts $value
0x09
This also protects you from set hello [exec echo malicious command here]
0x09orset hello 0x09? If it is0x09it is an integer (do what you want with it). If it is the later eval it in a safe interp.