Re: $line = <FH> returns incomplete lines
- From: Brian McCauley <nobull@xxxxxxxx>
- Date: Sat, 02 Apr 2005 09:21:11 +0000
axel@xxxxxxxxxxxxxxxxxxxxxx wrote:
>>Brian McCauley <nobull@xxxxxxxx> wrote:
axel@xxxxxxxxxxxxxxxxxxxxxx wrote:
The following seems to work.
That is missing the seek() that is needed to reset the EOF flag on MYLOG.
> > It works without the seek.
I think you were right the first time. It _seems_ to work. My understanding is that it is undefined if Perl's readline() will or will not reset the EOF condition when more data appears in a file.
Right now I can't find a platform on which your code fails but so long as it is officially undefined if it will work without the seek() I'd be inclined not to omit it.
it will work, sort of, but only because you are simply printing the output.
Each time some characters are picked up they are printed.
Yes, that was my point. You rely on the behaviour of the output device to give the false impression that split lines are being reassembled. (Note reassembly of the split lines is the subject of this thread).
If you wanted to do someting else - like selectively print lines by pattern match (as per OP) then it wouldn't work.
I find that it does... a slightly altered version
$line .= $_;
if (/\n/) {
$line = '';
}
Well, yes, of course, if you add the code that reassembles split lines then of course your solution is the same as all the others offered in this thread. (Remember, it is the reassembly of the split lines that is the subject of this thread).
.
- Follow-Ups:
- Re: $line = <FH> returns incomplete lines
- From: axel
- Re: $line = <FH> returns incomplete lines
- References:
- Re: $line = <FH> returns incomplete lines
- From: robic0
- Re: $line = <FH> returns incomplete lines
- From: Brian McCauley
- Re: $line = <FH> returns incomplete lines
- From: axel
- Re: $line = <FH> returns incomplete lines
- From: Brian McCauley
- Re: $line = <FH> returns incomplete lines
- From: axel
- Re: $line = <FH> returns incomplete lines
- Prev by Date: Re: $line = <FH> returns incomplete lines
- Next by Date: Re: difference between two files
- Previous by thread: Re: $line = <FH> returns incomplete lines
- Next by thread: Re: $line = <FH> returns incomplete lines
- Index(es):
Relevant Pages
|