Beginner wrote:
> Hi,

Hello,

> Error message:
> "Exiting subroutine via next at mk-thumbs.pl line 188"
> 
> 
> I have a script that uses File::Find. 
> 
> ...snip
> use strict;
> use warnings;
> use File::Basename;
> use File::Find;
> ...snip
> 
> find(\&wanted, @dirs_to_search);
> 
> In the callback for find I have this:
> 
> sub wanted {
> 
>  if ($_ !~ /html/) {
>         next;
>  }
> # next unless ($_ =~ /html/);         # Original line.
>  if (-f $File::Find::name) {
>          push(@dirs_to_delete,$File::Find::name);
>  }
> } # End of wanted
> 
> 
> When it's run I get hundreds of lines to STDERR that the call back is 
> exiting via next. Not a biggy but as the script is run from cron I 
> don't want to pour through hundreds of useless lines to see if there 
> are any legitimate errors.
> 
> Is there a way to suppress such errors? Does the warning come from 
> the warnings pragma? If so it looks configurable, can I restrict is 
> to just FATAL errors, if so any example would be appreciated.

wanted is a subroutine so you have to use return to exit from it:

return unless /html/;

You can only use next from inside a loop (while, foreach, etc.)



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to