title: Read lines from a file and skip to next line if pattern matches in perl
body: <p>I am trying to read lines from a file and write the output to another file. I am using open to achieve this. But I am not able to weed out some unwanted lines from the first file.
  here's the issue:</p>
  
  <p>I have a text file with the following lines</p>
  
  <pre><code>Project1_Employees
  Matt Stone
  Trey parker
  Eric Cartman
  Kenny
  
  Project2_Employees
  Stan
  Matt Stone
  Trey Parker
  Kyle
  </code></pre>
  
  <p>I am using my code to sort the names and print the uniq names. But I am not able to remove the lines Project1_Employees and Project2_Employees. This is only a part of the text file. There are hundreds of such lines.</p>
  
  <pre><code>open(FH, '&lt;employeenames.txt');
  next if (&lt;FH&gt; =~ m/Employees/);
  open(OFH, "&gt;sortedemployee.txt");
  my %seen;
  print OFH sort grep !$seen{$_}++, &lt;FH&gt;;
  close(OFH);
  close(FH); 
  </code></pre>
  
  <p>The output I am looking for is </p>
  
  <pre><code>Eric Cartman
  Kenny
  Kyle
  Matt Stone
  Stan
  Trey parker
  </code></pre>
  
  <p>I would like to do this using open as I have a requirement.</p>