in reply to File::Find exit
Note that I have replaced last in your example with die, which will cause the evaluation block to be short-circuited.my @nod; eval { sub foo {die if (/^p/i); push @nod, $_} find (\&foo, "./"); }; print "$_\n" for @nod;
I want the code to short circuit as soon as it sees a file beginning with letter 'p'. And the output of the code is just as expected -try.pl try3.pl try0.pl try4.pl try0.txt try9.pl try6.pl try7.pl try8.pl try10.pl try11.pl text.txt try12.pl try13.pl try14.pl try15.pl p01.pl p02.pl p03.pl p04.pl p05.pl p09.pl p10.pl p11.pl p12.pl try2.pl try1.pl webrobot.pl links.txt algorithm.pl mainfile.txt
try.pl try3.pl try0.pl try4.pl try0.txt try9.pl try6.pl try7.pl try8.pl try10.pl try11.pl text.txt try12.pl try13.pl try14.pl try15.pl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: File::Find exit
by sweetblood (Prior) on Oct 30, 2003 at 18:25 UTC |