upvar
is the right tool for that. The other commands can be emulated with upvar
.
But you do a mistake how you call upvar
. You have to use the variable name, not it's value (which will throw an "no such variable" error).
upvar var1 var1 var2 var2 ;#...
I'd think about using some different way to store the data, maybe a dictionary or an array?
This would make it easier to pass the variables.