while () { s/^\s+//; # get rid of leading whitespace s/\s+$//; # get rid of trailing whitespace tr/\r//d; # get rid of carriage returns the quick way tr/\n/³/; # superscript 3? I don't get it. s/.+ : //; # get rid of headers if (s/^\*+$//) { $count++; } # get rid of all asterisk rows, one for each record if (/(Cosmetics|Function)/) { s/.+_X_(Pass|Fail).*/$1/; # remove all but Pass or Fail } #### s/Failure Detail - //g; # must come before next regexp s/³(Pass|Fail)/³$1³/; # Pass -> Pass³, Fail³ -> Fail³³ (implied :)