Inside your process subroutine you do not chance directories to the current directory you're reading nor do you use the full path of the file. Instead calling process on $_. Which begs the question why doesn't your script raise an error? It seems calling -d on the file is insufficient. I think it would be wise to test whether the file you are passing to process actually exists.
One of the reasons for not catching this bug is that you have two nearly identical pieces of code. One in your main routine and the other your process subroutine. In this case you correctly called -d on the full path in you main code but not in your subroutine. It is errors like these why programmers eschew duplication. You have the process subroutine just call it initially instead of having a separate loop in you main code.
Addendum: Your code seems to be confused about whether to use absolute or relative paths. You need to either:
In reply to Re: Count folder/files in directory
by starbolin
in thread Count folder/files in directory
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |