and the other section looks about as compact as possible. I don't really see the point of s/.{129}//, though (it's not anchored, and 129 is an odd number). Perhaps substr would be more efficient. On second thought, you could do something like this:while (<REPORT>) { 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 }
That depends on some assumptions about your dataset, notably that there are no instances of "Fail" which don't meet the search criteria.s/Failure Detail - //g; # must come before next regexp s/³(Pass|Fail)/³$1³/; # Pass -> Pass³, Fail³ -> Fail³³ (implied :)
In reply to RE: clearer code
by chromatic
in thread clearer code
by Simplicus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |