in reply to Strange saving behaviour

In a word 'buffering'.

Try putting $|++ near the top of your script and see what happens.

Or read Dominus's article Suffering From Buffering for a more detailed explaination.

Update: ChOas's select code works, my $|++ doesn't :(

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: Strange saving behaviour
by arhuman (Vicar) on Feb 01, 2001 at 19:31 UTC
    That's what i thought too...

    So I put the $|=1 to force the autoflush,
    BUT it doesn't explain me why the last number is truncated ?

    the last numbers in my file are :
    9899 9901 9907 9917 9923 9929 9931 9941 9949 9959 9967 997

    notes the 3 digit number

      You might want to include an explicit close SAVE; after the loop. Notethis will do no good. we are in an infinite loop here.
        Why ? autoflush is on, so there's no buffering !
        So everything is written in the file as soon as the value is printed ?(but how could this value be written truncated ?If it was printing number digit by digit I could understand, but it isn't the case...)

        furthermore, perl close all filehandle on exit (I know it's dirty, but the point is what a close SAVE would change here ?)

        What am I missing ?