Retrieving the numeric variable value of a list in TCL
<p>I have a problem with TCL script.
in below code I have a list:</p>

<pre><code>set arcs {
    {a b $myVar(0)} {b a $myVar(1)} {b c $myVar(2)} {c f $myVar(3)} {b d $myVar(4)}
}
</code></pre>

<p>in $myVar($i) stored a numeric value.
and I have a function such as this :</p>

<pre><code>proc myProc arcs {
    foreach arc $arcs {
    lassign $arc v1 v2 cost
    dict set graph $v1 $v2 $cost
    }
    return $graph
}
</code></pre>

<p>I called function :</p>

<pre><code>myProc $arcs
</code></pre>

<p>but in the function, I can`t retrieving to numeric the value stored in $ab($i) and only name of variables stored in the $cost. such as this: </p>

<pre><code>$v1 ----&gt; a
$v2 ----&gt; b
$cost ----&gt; $myVar(0)
</code></pre>

<p>please tell me how I can pass the values of variables to function. such as this:</p>

<pre><code>$v1 ----&gt; a
$v2 ----&gt; b
$cost ----&gt; 25    /// value of $myVar(0)
</code></pre>

<p>I am new in tcl and I can`t solve the problem. I will really appreciate for your aid.</p>