title: How can I write only certain lines of a file in Perl?
body: <p>I am looking for a way to read an input file and print only select lines to an output file in Perl. The lines I want to print to the output file all begin with <code>xxxx.xxxx.xxxx</code>, where <code>x</code> is an alphanumeric character (the periods are periods, not wildcards). The lines do not all have the same ending, if that makes a difference. I'm thinking something like the following (the condition of the <code>if</code> statement is all that is really missing as far as I can tell).</p>
  
  <pre><code>open(IN, "&lt;$csvfile");
  my @LINES = &lt;IN&gt;;
  close(IN);
  open(OUT, "&gt;$csvnewfile");
  print OUT @LINES if ([line starts with xxxx.xxxx.xxxx]);
  close(OUT);
  </code></pre>
  
  <p>Thanks in advance!</p>