Couple of things.
First, I would keep the output file open during the whole find operation, by wrapping it around the finddepth:
open FH, ">$WriteDirectory/$file" || die "Can't open $file: $!";
finddepth(&perms, $TraverseDirectory);
close FH;
Second, you don't need to backtick-execute pwd. The dir is in $File::Find::dir
see: perldoc File::Find
Just curious, are you doing depth-first for a specific reason?
There are several files and directories under the directory that I'm searching and there has to be an easier way than by going through each directory by hand.
If you really need to visit all the files like this to gather perms info, I don't think there really is an easier way than File::Find
Update: Trying this out on my system, I see it gives the "strict refs" complaint. It needs to be:
finddepth(\&perms, $TraverseDirectory); |