On Tue, Nov 17, 2009 at 1:33 PM, Issac Goldstand <[email protected]> wrote:
> I currently have an external command which I run in my script through
> backtics It takes several minutes to run to completion.
>
> I'd like to print the output immediately, with an added bonus if I can
> do s/\n/<br>/gs on it on-the-fly.
>
> Any good ideas?
Something like this ?
open my $ph, "$cmd |" or die;
while (my $line = <$ph>) {
$line =~ s/\n/<br>/gs;
print $line
}
Gabor
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl