in reply to File::Find exit

What is this "before" that you speak of? The order of entries in a directory mayn't be the order that you think. It's best not to rely on a particular ordering and impose your own.

That said, it would be a nice if there were a mechanism to immediately stop the recursion of File::Find::find(). You can achieve that the poor man's way though:

my $stop_the_insanity = 0; sub wanted { return if $stop_the_insanity; ... # some condition that sets $stop_the_insanity ... } find(\&wanted, @paths);

Replies are listed 'Best First'.
Re: Re: File::Find exit
by bluto (Curate) on Oct 29, 2003 at 20:04 UTC
    If you don't set "bydepth", you can stop the recursion by setting $File::Find::prune. So ...
    my $stop_the_insanity = 0; sub wanted { $File::Find::prune = $stop_the_insanity; return if $stop_the_insanity; ... # some condition that sets $stop_the_insanity ... }

    bluto