foreach my $attribute (@data_in_attributes) { # validate data attribute type by performing # lookup for the regular expression from the spec memory structure if ($attribute =~ m/$spec_all_attributes[$attribute_position][1]/) { # Correct data type, the output value is same as input value push @data_out_attributes, $attribute; } else { # Bad data type, use default provided in the spec for output value push @data_out_attributes, $spec_all_attributes[$attribute_position][2]; $total_errors++; print log_file "Error ", $total_errors, ". Data type error on line: ", $line_number, ", attribute: ", $attribute_position + 1, " (", $spec_all_attributes[$attribute_position][0], ")\n"; } # terminate if too many errors (<-- but perhaps this is obvious??) last DATALINE if ($total_errors >= $max_errors); $attribute_position++; }