in reply to Re^2: Recursive sub efficiency
in thread Recursive sub efficiency

My mistake. I updated my code.

Comment out your @files line, then @dirs should contain something. You can not call readdir two times like that.