Irfan Sayed wrote:
hi,
Hello,
i need to print the output of a command on the console at runtime lets say, i need to execute find command .as of now , what i am doing is , @cmd= `find . -name "abc"`; print "@cmd\n"; now what happens is, once the command completed then it will send entire output to @cmd and then entire output gets printed to console in one shot instead of that , i need output to be printed as it progresses
open my $PIPE, '-|', 'find', ',', '-name', 'abc' or die "Cannot open pipe from 'find' because: $!:
while ( <$PIPE> ) { print; } close $PIPE or warn $! ? "Error closing 'find' pipe: $!" : "Exit status $? from 'find'"; John -- Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. -- Albert Einstein -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/