in reply to Limit Find();

This works... but is horribly inefficient because it doesn't stop searching through the files just printing them.
use File::Find; find(\&wanted, $ARGV[0]); my %dir = (); sub wanted { if ($dir{$File::Find::dir}++ < 10) { print $File::Find::name, "\n"; } }
Update: Seems a bit harsh to downvote me for giving some code that answers the question...

gav^

Replies are listed 'Best First'.
Re: Re: Limit Find();
by petral (Curate) on Jan 31, 2002 at 21:11 UTC
    Wouldn't this work?
    use File::Find; eval {find(\&wanted, $ARGV[0])}; print "@found"; my @found = (); sub wanted { push @found, $_; die if @found == 10; }

        p