in reply to File::Find problem

I have a suggestion about a redesign that might help (although I'll admit I haven't figured out why your code isn't working -- one guess is that you're reading the perldocs for the wrong version of File::Find, but I don't know off the top of my head at which version the pre- and post- process options were added, but defeasible memories suggest it is VERY recent; check perldoc File::Find on your own system to see if your version supports these options).

My suggestion is this: do away with the flag variable, and just have your "wanted" routine process the directory itself.

sub process { return unless -d; opendir DIR, $_ or die "Can't open $File::Find::name: $!\n"; my @old = grep /\.old$/i, readdir DIR; closedir DIR; return unless @old; # now write what you have to }

This is a little bit inefficient (it ends up reading the directory twice), but I think it gains a bit in clarity. If my guess above is right, it will work whereas your current algorithm won't unless you upgrade perl (or at least File::Find) on your system.

There are a few things you're doing that don't comport with what you say you want to do. Do you want to append lines to the CPB files or do you want to write new ones? Also, that else in the postprocess sub is unnecessary.

update shoulda checked the File::Find docs .. .the pre and postprocess facility has been there for a very long time, so my guess is wrong. Musta blocked that part of the docs out. Also, go ahead and disregard the comment about "appending", I hadn't read that part of your code very closely.

If not P, what? Q maybe?
"Sidney Morgenbesser"