Your example #4 is what I had tried first, but without the ".*" parts. I'm still not sure why they're needed. What I thought I was asking for was a match with any digit no matter where it was in the string. My bad.

At this point, after adding the ".*", it's doing just what I expected. Hurray!

As to the need for ++$i; don't I need to change the offset each time I read the file in order to step further into the file to get the next digit? You seem to be implying that that's unneeded. Does sysread auto-increment it's own offset when it's used in a loop? If I just remove the ++, I get a runaway loop, so I guess not. What did you have in mind, please?

I could leave it just the way it is, but I'd rather understand sysread a little better.

ggg

In reply to Re^2: sysread and null characters by ggg
in thread sysread and null characters by ggg

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.