Using upvar, I can control at which level I should access the variable, and with a fixed name, while global only access the variable under the same name in globalspace. You could probably modify the code with ease to use global instead.
I'll give you a simple example, as I'm not sure you are keeping the array index name and it's value apart...
Code: Select all
set var "Testing
Testing
Testing"
set myArray($var) "This is a value
spanning multiple lines
and containing several words...
The array index holding this value also has several newlines"
##or simpler:
set myArray(line\ 1\nline\ 2) "Some\ndata..."
Both versions will add values to the myArray array, each value containing at least one newline, and each array index name also containing both newlines and spaces...