Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello hippo,

I just tried your code on a Windows 10 machine and here it fails. Result:

1..8 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/ 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/ 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?


In reply to Re^2: Calculated position incorrect when using regex in text file that also contains binary info by geertvc
in thread Calculated position incorrect when using regex in text file that also contains binary info by geertvc

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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> <u> <ul>
  • 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 intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2021-10-28 09:24 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (96 votes). Check out past polls.