in reply to How to make this perl version of "du" faster?
Install a decent profiler and run it on your code. Identify the hotspots. Optimize them.
See also: perlperf.