foreach my $thing (@array) { process($thing); add_to_processed($thing); } sub process { my $thing = shift; next if boring($thing); .... } sub add_to_processed { my $thing = shift; last if too_many($thing); .... } #### for my $case ( @cases ) { my $is_interesting = eval { interesting($case) }; print "$case had errors:$@" if $@; next unless $is_interesting; eval { process($case) }; if ($@) { print "$case had errors:$@"; } }