sub msh_fields { ($mshseg) = @_; @vals = split('\|', $mshseg); $docsource = $vals[3]; $trandate = $vals[6]; $doctype2 = $vals[7]; $rectype = $vals[8]; $unique_hl7_id = $vals[9]; if ($rectype ne 'ORU^R01'){ # Discrete Results only next MAIN; # Label that ends the script } }