in reply to A very deep recursion and the GD module (problem)
Apart from using strict I would recommend using File::Find to do any and all of your directory recursion. Its a great module and I would use it anywhere you need to do directory traversals of this type.