On Thursday, March 21, 2002, at 05:16 PM, Ari B Kahn wrote:
> I'm running a perl CGI script that needs to execute another external 
> perl
> script on the same machine.  I would like to see the screen output of 
> this
> external script as well. What is a good way to do this?
>
> I was trying
> system ("/Users/username/perl_dir/perl_script --flags other_arguments");
>
> It doesn't seem to work though.

Hi Ari,

I'm not sure exactly what you're trying to do, since your terms "see" 
and "work" are somewhat ambiguous.  But I suspect you'd want something 
like this:

   open CMD, '/Users/username/perl_dir/perl_script --flags 
other_arguments |'
     or die $!;
   my $output = do {local $/; <CMD>};
   close CMD
     or die $!;


  -Ken

Reply via email to