Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Now if I added a print statement anywhere in there with a newline character it printed as it went along like it is suppose to.#!perl -w use strict; my $count = 0; my $times = 0; my $sec = 0; print "Doing something "; while (1) { my $time = localtime(); my @broken = split(/ /, $time); for (@broken) { $time = $1 if (/((\d+)\:(\d+)\:(\d+))/); } my @stime = split(/\:/, $time); if ($sec < $stime[2]) { $count++; } $sec = $stime[2]; if ($count == 5) { print ". "; $count = 0; $times++; } last if ($times == 12); } print " done!\n";
Any explanation of this behavior?#!perl -w use strict; my $count = 0; my $times = 0; my $sec = 0; print "Doing something "; while (1) { my $time = localtime(); my @broken = split(/ /, $time); for (@broken) { $time = $1 if (/((\d+)\:(\d+)\:(\d+))/); } my @stime = split(/\:/, $time); if ($sec < $stime[2]) { $count++; print "Incremented count!\n"; } $sec = $stime[2]; if ($count == 5) { print ". "; $count = 0; $times++; } last if ($times == 12); } print " done!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Won't print unless newline is included?
by bmann (Priest) on Apr 27, 2004 at 22:26 UTC | |
|
Re: Won't print unless newline is included?
by Räuber Hotzenplotz (Acolyte) on Apr 27, 2004 at 22:27 UTC | |
|
Re: Won't print unless newline is included?
by davido (Cardinal) on Apr 27, 2004 at 23:07 UTC | |
|
Re: Won't print unless newline is included?
by sgifford (Prior) on Apr 27, 2004 at 22:28 UTC | |
|
Re: Won't print unless newline is included?
by pizza_milkshake (Monk) on Apr 27, 2004 at 23:33 UTC |