I want to avoid reading in the entire file, since I am under the impression that I can save memory that way, and it is very easy to let Perl take care of where in the string I am (tell), let me step through it (read) and jump to where I need to be (seek). All of this is possible, I'm sure, in a string, but I'm guessing not as easy.

Whether or not you are allowed to match via a pointer, I don't know. It isn't breaking anything, it just isn't working. I am not sure why it is not working, but I am under the impression that it is matching on the first record ID over and over again, and never moving on.

I could be wrong. I'll play some more and see.

-Travis

v2:

Okay, no, I can't match via the file handle. I can do <FIN>=~m//g;, but I imagine that is because it reads <FIN> into $_ and then does the m//g, which means I am reading in the entire file anyway! Nothing saved there, might as well read it all into $str.

-Travis

In reply to Parsing and \G and /g and Stupid User Tricks: $fileHandle =~ m//g;: v2 by THuG
in thread Parsing and \G and /g and Stupid User Tricks by THuG

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.