Matt Diephouse <[EMAIL PROTECTED]> wrote: > On Fri, 28 Jan 2005 09:49:06 +0100, Leopold Toetsch <[EMAIL PROTECTED]> wrote: >> Matt Diephouse <[EMAIL PROTECTED]> wrote: >> >> > The readline opcode returns too many lines. Compare the following pir >> > with `wc -l`. >> >> > unless file goto END >> > $S0 = readline file >> >> It needs (currently) a test for an empty string: >> >> unless $S0 goto END
> I already use that workaround in some of my code, but that sorta > defeats the purpose of testing the filehandle itself. The filehandle > should become false after it returns the last line of the file - not > the last line plus an empty string. Looked again at that stuff. You are testing for EOF before the readline, which implies that EOF should be set along with returning data. This seems to be wrong. So the correct way seems to be: unless file goto END LOOP: $S0 = readline file unless file goto END $I0 += 1 goto LOOP BTW: if you replace "$S0 = readline file" with "$S0 = read file, 1" in your original example you get again the amount of chars + 1. So it's consistent. leo