in reply to Re: File::Find problems
in thread File::Find problems

my @filenames = readdir DIR; ... foreach my $file (@filenames) { if( -d $file or $file eq $0 ) ... }

I doubt that the 2d part of the test will produce the desired result beacuse of ...

readdir DIRHANDLE ... If you're planning to filetest the return values out of a "readdir", you'd better prepend the directory in question. Otherwise, because we didn't "chdir" there, it would have been testing the wrong file.

Replies are listed 'Best First'.
Re^3: File::Find problems
by bobf (Monsignor) on Sep 10, 2004 at 23:45 UTC
    Very good point. I set $currentdir to '.' to simplify the example, and forgot about it when I got to the loop. I'll update the code to include the full path of each $file. Thanks for pointing it out.