while () { #@outLines = (); ($etc,$etc) = split (/\s+/, $_) if (/^# input.*/); ($space, $Nd, $RES, $PDB, $val) = split (/\s+/, $_) if (/^\s\s\d+.*/); if (/^\s+\S+\s+\S+\s+$NUM17\b/) {$val = (split)[3]} elsif (/^\s+\S+\s+\S+\s+$NUM18\b/) {$va2 = (split)[3]} push (@outLines, $val); print OUT @outLines; }