note
wisely
Sorry I forgot to mention this was only a snippet of the whole program, and it wasn't exactly accurate to what I had in actual program.<br>
I just wanted to illustrate what the direction in which I was headed for solving this.<br>
Sorry also that I couldn't just paste the whole code.<br>
Anyway in my actual program it turned out that the issue was the scope of the $dir variable in my subroutine as far as I can tell.<br>
The program works correctly now.<br>
I guess it would be better (also faster?) if it is done in the main program and not in a subroutine, but it was easier for me to follow what I am doing by writing subroutines. I am also not sure how to do what you mention.
11136202
11136430