title: How to capture specific strings from a file and dump it to diff file in perl
body: <p>I have a log file which contains results of various test conditions. It looks like</p>
  
  <pre><code>Starting TestCon1
  Msg1:Criteria
  Result:pass
  Msg2:Criteria
  Result:fail
  
  Starting TestCon2
  Msg1:Criteria
  Result:fail
  Msg2:Criteria
  Result:pass
  
  Starting TestCon3
  Msg1:Criteria
  Result:pass
  </code></pre>
  
  <p>I want to create a subroutine which just picks out the "Msg which have failed along with The TestCon they belong to.This will get dumped to a summary file showing-->
  The Msg which failed ,the result and the TestCon it belongs to</p>
  
  <p>I have no clue where to start with ,Can anyone give me an idea where to start with</p>