title: Is there a better way for cross-platform newline support on Perl?
body: <p>I've been struggling to update a few Perl scripts for full cross-platform support. This means UTF-8 text files written on a Linux, Mac or Windows must be read, parsed and interpreted correctly on any of the other platforms without knowing which platform created them. </p>
  
  <p>I tried setting the <code>$/</code> record separator with disastrous results. I finally settled on using the default value for <code>$/</code>, reading the file with the Perl's default platform support, and then stripping every line using <code>s/[\r\n]//g</code>. </p>
  
  <pre><code>while(my $line = &lt;$IN&gt;) {
      $line =~ s/[\r\n]//g;
      ... do other stuff...
  }
  </code></pre>
  
  <p>My question is there, is there a better way of doing this?</p>