Jerry Preston wrote:
> You are correct, I am trying to capture the output from your external
> program and assign it to a variable.
>
> I just tried:
>
> @ID = ( "$program", "$ID" );
> system( @ID );
>
> and I get what was passed in "$program", "$ID".
>
> Have I missed something?
<snip>
Yes.
(from `perldoc -q 'command'`)
=begin
How can I capture STDERR from an external command?
There are three basic ways of running external commands:
system $cmd; # using system()
$output = ‘$cmd‘; # using backticks (‘‘)
open (PIPE, "cmd │"); # using open()
=cut
`system` will get you the return code of the command being run.
(from `perldoc -f system`)
=begin
The return value is the exit status of the program as returned
by the "wait" call. To get the actual exit value shift right
by eight (see below). See also "exec". This is not what you
want to use to capture the output from a command, for that you
should use merely backticks or "qx//", as described in
"‘STRING‘" in perlop. Return value of -1 indicates a failure
to start the program (inspect $! for the reason).
=cut
The other two methods will get you the actual output from the command.
Execute the perldoc commands from above (or visit
http://www.perldoc.com/) for further information. If you're still
stuck, post again.
HTH
Jim