Diamondust has asked for the wisdom of the Perl Monks concerning the following question:
I was trying to write a simple while loop:
Can this be considered as a bug then?
perl -e 'while(1){sleep 1; print 123;}' # prints nothing
perl -e 'while(1){sleep 1; print 123 . "\n";}' # this works
perl -e 'while(1){sleep 1; print "123\n";}' # this works also
perl -e 'for($i=0; $i < 10; $i++){sleep 1; print $i;}' # this works but prints nothing within 10 seconds.
I seems that perl does not flush a printed string without seeing a NL character, is that the right interpretation of this peculiar behavior?Can this be considered as a bug then?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: The delay of printing encountered using loop
by Perlbotics (Archbishop) on Jun 25, 2012 at 21:54 UTC | |
by Diamondust (Novice) on Jun 26, 2012 at 12:24 UTC | |
by Anonymous Monk on Jun 26, 2012 at 21:24 UTC | |
by Diamondust (Novice) on Jun 27, 2012 at 11:26 UTC | |
Re: The delay of printing encountered using loop
by frozenwithjoy (Priest) on Jun 25, 2012 at 22:02 UTC | |
by morgon (Priest) on Jun 25, 2012 at 23:35 UTC |
Back to
Seekers of Perl Wisdom