I just tried your code on a Windows 10 machine and here it fails. Result:
ok 1 - No 1 first match starts at 26
ok 2 - No 1 first match ends at 33
ok 3 - No 2 first match starts at 68
ok 4 - No 2 first match ends at 75
ok 5 - No 3 first match starts at 87
ok 6 - No 3 first match ends at 94
not ok 7 - No 4 first match starts at 1315
# Failed test 'No 4 first match starts at 1315'
# at E:\AppData\Programming\Perl\ReadFile/hippo.pl line 50.
# got: '1139'
# expected: '1315'
not ok 8 - No 4 first match ends at 1322
# Failed test 'No 4 first match ends at 1322'
# at E:\AppData\Programming\Perl\ReadFile/hippo.pl line 51.
# got: '1146'
# expected: '1322'
Even the "got" values (calculated based on the Windows OS) are not correct when checking the location of the items in a text editor (I'm using NPP as text editor) in Windows. It should be 923 and 930 for the 4th object (as opposed to 1139 and 1146 in your script result).
So, "a" conclusion might be that Windows (once again) differs from Linux in the way files are handled.
Would there be a need to open the file with a specific encoding
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.