The problem is not that a newline is not present, it is that (in the above case) the last line is
17: 5450 :0:0 19: 5453 :0:0 20: 14626 :0:0:D There is not another line afterwards, but I have no text clues that that is the last line containing process information.
Here is two input samples, to hopefully make this more clear than my explanation. (The lines of hyphens are delimiters, and they are not in my input).
---------------------------------------------------------
ClientSystemName (clisysname): 'SPIFF', Client LongId: '0008027E1180,/
+epic/tst/cachesys/mgr/'
PIDTAB for 128 jobs: (Job:PID:reswake:sflg[:D if dead]
Job: PID:resw:SF:D
1: 5382 :0:0 2: 5384 :0:0 3: 5385 :0:0 4: 5386 :0:0
5: 5394 :0:0 6: 5387 :0:0 7: 5388 :0:0 8: 5389 :0:0
9: 5390 :0:0 10: 5391 :0:0 11: 5392 :0:0 12: 5393 :0:0
13: 5456 :0:0 14: 5444 :0:0 15: 5445 :0:0 16: 14682 :1:0:D
17: 5450 :0:0 19: 5453 :0:0 20: 14626 :0:0:D
-------------------------------------------------------
ClientSystemName (clisysname): 'SPIFF', Client LongId: '0008027E1180,/
+epic/tst/cachesys/mgr/'
PIDTAB for 128 jobs: (Job:PID:reswake:sflg[:D if dead]
Job: PID:resw:SF:D
1: 5382 :0:0 2: 5384 :0:0 3: 5385 :0:0 4: 5386 :0:0
5: 5394 :0:0 6: 5387 :0:0 7: 5388 :0:0 8: 5389 :0:0
9: 5390 :0:0 10: 5391 :0:0 11: 5392 :0:0 12: 5393 :0:0
13: 5456 :0:0 14: 5444 :0:0 15: 5445 :0:0 16: 14682 :1:0:D
17: 5450 :0:0 19: 5453 :0:0 20: 14626 :0:0:D
From Directory: /releng/b/obj/5.0.20/build6305_0_3627/linux
The time is: Tue Aug 29 14:11:17 2006
.
.
.
------------------------------------------------------
So there can be more random junk that I don't want to include after the process list that I'm looking at. In that case, my flip flop works, however when my input ends abruptly, without the extra blank line, I don't have a way of resetting it.
Like I said above, I can just keep track of the state in a scalar, maybe that is the better way to do it. I just thought that there may be a different solution.
-
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 How to display code and escape characters
are good places to start.