in reply to
Recursive file processing from a path and printing output in a file
Reading your directory structure with readdir and with File::Find is not quite what I had in mind when I answered your previous question. Everything you're doing in the while loop could be attached to your wanted function, reducing the overall work and complexity of your script. If your 'wanted' is getting to complicated, just break it out into smaller chunks of logic. Have you read the documentation for File::Find yet?
You (the programmer) are working twice as hard as you need to (and so is your script).