Op donderdag 31 mei 2012 13:09:25 UTC+2 schreef anand kumar het volgende:
Arrays in Tcl are actually collections of variables. As such they
can not be passed "by value" as with all other variables. What you
can do instead is:
proc data_process {array_name} {
upvar 1 $array_name data_array
...
}
This way, you connect the array whose name you pass to the procedure
data_process to a local array with the name "data_array". You can
get the array elements and you can change the values or add new ones.
Another solution (especially useful if you only want to look at the
data that passed, not change them) is to use a list of data or a
dict. The latter is a kind of combination of a plain list and an array
in that you can select data via a key instead of an index.
Regards,
Arjen