my %data_h = (previously calculated data); my @errors; # store errors here my @passed; # list items that passed the tests foreach (@list) { if ($condition{'a'} == 1) { # perform test A on $_ using data from %data_h # if it fails, add an error message and go on to # the next list item } if ($condition{'b'} == 1) { # perform test B on $_ using data from %data_h # if it fails, add an error message and go on to # the next list item } # and so on, with several other tests # if it survives all these tests... push @passed, $_; } if (@passed) { # etc.