I don't want to discourage you from figuring out the proper way to use File::Find, but in my own experience, this module has normally been significantly slower in any task when compared to the standard "find" shell utility (and let's face it, File::Find's usage has a strange, counter-intuitive feel to it, which has tripped up a lot of folks).
Given your situation, that suddenly the list in "$html_dir/$good_file" happens to contain items with internal spaces, I would be inclined to figure out how to keep using the shell "find" approach -- e.g.:
Being able to put double quotes around the path argument in the find command line makes all the difference.open (LIST, "<$html_dir/$good_file"); my @paths = <LIST>; close LIST; chomp @paths; my $total = 0; for my $p (@paths) { my $count = qx/find "$p" -type d -name class | wc -l/; chomp $count; $total += $count; }
You might think you spend a lot of overhead running this many subshells with "qx//", but I wouldn't be surprised if this still ends up running faster than the equivalent File::Find solution (once you get that working -- good luck with that).
update: added "$total" to the code sample.
In reply to Re: Problems using File::Find
by graff
in thread Problems using File::Find
by thewalledcity
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |