On Sun, Nov 30, 2008 at 00:52, Richard <[EMAIL PROTECTED]> wrote:
> i have a c program that I want to just run from perl and capture output
>
> I would have thought
>
> my $c_output = `/tmp/c_program`;
>
> would get me the output of the program.
>
> instead it prints out to the screen.
>
> Is there way to redirect STOUT just for that line and put it back to normal?

Take a closer look at your c program.  Backticks do indeed grab
stdout, so it must be writing to stderr (or worse yet the console).
Try

my $c_output = `/tmp/c_program 2>&1`;


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to