Hello, it's me again, and I'm still working on the same script that I have posted about previously. I am to the point where everything is working, except my script is only reading the first 200-205 lines of my 1800 line text file. My question is simple. When using :
while (<FOO_FILE>){ if (/$foo/){ $that = 1; } if (/$bar/){ $that = 0; } if ($that){ print $_; } }
The file contains a list of equipment, and comments that someone has put in about the equipment for the day. I am sorting all comments by equipment number...eg.

Apr 23 2001 0630
Tool01 - ran good
Tool02 - replaced inner bearing

Apr 24 2001 2330

Tool01 - Broke spindle temp transducer
waitin on replacement
Tool02 - Did not run today
I have it set up to start printing when it sees the first tool I am looking for, and stops when it sees the next one. It does this fine, except it stops in the middle of the file. I set up a counter to see what line it goes to, and it is usually line 204. This is a different point in the file depending on what date I put in for the start. In other words, it stops on about the same line every time, but the content of that line is different almost every time. I am not able to post the actual file due to the nature of my work, but I quess I actually have two questions. Is ther an easier way to test and print between two points in a file, and how can I make sure that it will scan the entire file each time. Stuffy Welcome to the life of the perpetually confused.

In reply to Reading entire file. by stuffy

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.