From the lindex manual , my focus:
When presenting one index, the lindex command treats the list as a Tcl list and returns an index'th element from it ( 0 refers to the first element of the list )
So, you will need to use something more:
foreach {fname} <program to get values> {
set dfrom [lindex $fname 0]
set rname [lindex $fname 1]
print "fname- $fname"
print "dfrom- $dfrom"
print "rname- $rname"
}
And if you are using Tcl 8.5 or later, you can use lassign:
foreach {fname} <program to get values> {
lassign $fname dfrom rname
print "fname- $fname"
print "dfrom- $dfrom"
print "rname- $rname"
}
source
share