Text Lines are missed when reading a file Line by Line in Perl. <cr> <lf> mismatch <p>I want to extract and log various parameters from a 3G modem as there are intermittent dropouts. As such I am using wget to read <code>3Ginfo.html</code> from a 3G modem and placing the contents into a file <code>contents.txt</code>. Using Notepad++ to open this file shows all of the data.</p> <p>Due to my reputation, I cannot post pictures, therefore the code below is the best I can do; from Notepad++ (with View All Characters turned on), I get:</p> <pre><code>&lt;tr&gt;[LF] &lt;td class='hd'&gt;Signal Strength:&lt;/td&gt;[LF] &lt;td&gt;[LF] -72[CR] &amp;nbsp(dBm)&amp;nbsp(High)&lt;/td&gt;[LF] &lt;/tr&gt;[LF] </code></pre> <p>However, when the file is read line by line from Perl, it is clear that there are less lines than those reported by Notepad++ and data is missing. In this case the actual signal strength value is missing.</p> <p>Here is the Perl code to read the file:</p> <pre><code>open hLOGFILE, "&lt;output.txt"; while (&lt;hLOGFILE&gt;) { print "Line no $. Text is $_ "; } </code></pre> <p>Here is the output (as text, because I cannot post pictures yet):</p> <pre><code>Line no 98 Text is &lt;tr&gt; Line no 99 Text is &lt;td class='hd'&gt;Signal Strength:&lt;/td&gt; Line no 100 Text is &lt;td&gt; &amp;nbsp(dBm)&amp;nbsp(High)&lt;/td&gt; Line no 102 Text is &lt;/tr&gt; </code></pre> <p>It is clear that there are missing lines and it is related to the <code>&lt;cr&gt;</code> end of line terminator. I have tried slurping the file and the lines are still missing.</p> <p>Apart from reading byte by byte and then trying to parse the file that way (which is not very appealing) I can not find a solution.</p> <p>My plan is to simply extract and log the lines of interest every minute or so.</p> <p>I have tried opening the file specifying various encoding but still no joy. If Notepad++ can read and display all the data, why does it not work in Perl. When using <code>more</code> from the Windows XP command line, it show that the data is also missing.</p> <p>When I view source from chrome I get,</p> <pre><code>&lt;tr&gt; &lt;td class='hd'&gt;Received Signal Code Power(RSCP):&lt;/td&gt; &lt;td align='center'&gt; -78 dBm&lt;/td&gt; &lt;/tr&gt; </code></pre>