DEFECTID ATTR1 ATTR2 ... ATTR30 #### DEFECT: foreach my $defect ( @$list ){ # $summary is my pseudo object, # this line converts each defect line into a hash # whose keys are the attributes desired to be selected my $line = parseLine( $summary, $defect ); if ( ! $line ){ next DEFECT }; RULE: foreach my $rulenum ( keys %$rulelist ){ # one example rule, but there are many.. if ( defined $rulelist->{$rulenum}->{REGION} ){ my $rule = $rulelist->{$rulenum}->{REGION}; if ( $rule =~ s/!// ){ # handles negation if ( $line -> {REGIONID} == $rule ){ next RULE }; } elsif ( $line -> {REGIONID} != $rule) { next RULE }; } } # i create a filtered list in the $summary hash push @{$summary->{FILTEREDLIST}->{$rule}}, $defect; }