[Israel.pm] printing the output of `command` with immediate flush
Offer Kaye
offer.kaye at gmail.com
Tue Nov 17 03:57:18 PST 2009
On Tue, Nov 17, 2009 at 1:47 PM, Gabor Szabo wrote:
>
> Something like this ?
>
> open my $ph, "$cmd |" or die;
> while (my $line = <$ph>) {
> $line =~ s/\n/<br>/gs;
> print $line
> }
>
Looks right to me, except I think Issac will need to set autoflush,
e.g. using "++$| ;" at the beginning of his script, to get output
immediately as he asked for.
--
Offer Kaye
More information about the Perl
mailing list