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

No. The problem here is that you aren't completely reading documentation.

exit exits an entire process stack (ie. your program). return does leave the subroutine.

This, combined with the preprocess misconception is what's causing your issues.

Replies are listed 'Best First'.
Re^3: File::Find preprocess
by pvaldes (Chaplain) on Jan 08, 2018 at 17:13 UTC

    Hum, I see. I was expecting an equivalent to the "previously" condition in a common-lisp loop structure. A chunk of code that happens only once before the main body of the function starts iterating. I understand that if I need to do something within each subdirectory (check if something happens inside each subdir first), I would need then to traverse the tree two times using two different find functions. One for directories only, and a second for all files. Right? can't be done in one take?

      I'm a bit unclear exactly what you're asking, but if you want to do something for files and something different for directories:

      sub wanted { if (-d){ print "directory\n"; } if (-f){ print "file\n"; } }

        Mmmh. Could work, I'll try this and see what happens. Thanks