Debugging Assistance

I'm trying to append a number to the end of every element in a text wave using the commands:

NVAR v_FileNumber
duplicate /o Runs, w_Runs
w_Runs += num2str(v_FileNumber)

This works all fine from the Command Window but when used in a function I get an unknown/inappropriate name or symbol.

Any help would be appreciated.
You have to tell Igor explicitly that you deal with text waves:
function appendFileNumber()
    wave/T Runs
    NVAR v_FileNumber
    duplicate/O/T Runs, w_Runs
    w_Runs += num2str(v_FileNumber)
end