I agree - that's the only change I made to the alternative that I recommended at the end of the post.
In that case I passed the values by reference, to preserve the behaviour of the original function (which modified the passed variable.) | [reply] [Watch: Dir/Any] |
Yes, I agree with you both (of course).
The tricky bit about just passing in the variables is that you'd need to redefine the interface of the sub (that is, return the modified values instead of editing in place). Which - for the people who stand to benefit the most from this Tutorial - might be a lot of work. If your script began with global variables in the first place, there's a good chance the rest of the program is procedural in nature.
imp, Your solution with passing by reference is even better than ikegami's, in that I expect it to be easier to understand.
| [reply] [Watch: Dir/Any] |