in reply to Print the output from the pipe while waiting

this could be because of buffering. (perl actually does not send one line at a time; it waits for more FIRST unless you tell it differently).

There is a very excellent and easy to understand explanation at: http://perl.plover.com/FAQs/Buffering.html

Probably what you want is:
use IO::Handle; STDOUT->autoflush;
But do read the FAQ and all will become clear.

Replies are listed 'Best First'.
Re^2: Print the output from the pipe while waiting
by Anonymous Monk on Mar 07, 2008 at 15:26 UTC
    Thank you your reply. The article is very detail. I know Buffering will give me the feeling of the dalaying, but the magical thing is: I called time() or Time::HiRes method before pipe call to capture the timestamp before the pipe opened, then I capture another timestamp after the pipe closed; while the program itself will display a time of execution as well. I found the time shown in perl is always less than the time shown in the pipe result largely......I checked the documentation and I am quite sure the time unit is correct and the method I used to get the interval is from the sample code, so I don't think this is the buffering problem...any idea?