This is not confusing if you think of gsub as a function that takes 3 parameters. The value of the 2nd parameter has to be evaluated before the function is called.
As you can see the value of what's being replaced cannot be known until the funtion returns and at this point the 2nd parameter has already be evaluated.
Ahhh... now it makes sense. (Although I had to re-read your post a few times )
I guess I was hoping that the function would take as a second argument a pointer of the array, then the element could be retrieved from within, after the captured pattern is known.
(I'm thinking in terms of C-style array, whereas assoc. arrays of awk are quite different, aren't they?)
Thanks a lot once again.