#!/usr/bin/perl use warnings FATAL => 'all'; use strict; my @cases = 1..19; for my $case ( @cases ) { if (eval { interesting($case) }) { eval { process($case); }; print "$case had processing errors: $@" if $@; } elsif ($@) { print "$case had interesting errors: $@"; } else { print "$case not interesting.".$/; next; } } sub interesting { my $case = shift; die "random failure on interesting" if rand() > 0.7; return rand()>0.5?1:0; } sub process { my $case = shift; print "doing something with $case".$/; die "random failure on process" if rand() > 0.7; }