On Fri, Mar 01, 2002 at 06:45:53PM +1100, Adam Kennedy wrote:
> Or if the return values are more substantial....
> #!/usr/bin/perl
> 
> # Get the first lot of results
> @stdout_from_c_program = `'first-c-program`;
> die "Didn't get anything" unless @stdout_from_c_program;

die "program returned non-zero exit code ($?)" if $?;

> # Some processing ( or not )
> @args = munge( @stdout_from_c_program );
> 
> # Hand the processed ( or not ) results to the second program ( assuming you
> need to pass to the c program ).
> system( "second-c-program $arg[0] $arg[1] $arg[2] etc" ); # Assuming you
> need to get

you will want to read "perldoc -f system" if you want to interpret $?.

** note that system() returns the process exit code.      **
** ie:  0 (false) on success, non-zero (true) on failure. **

-- 
 - Gus
-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to