At 11:17 PM -0700 5/23/11, Irfan Sayed wrote:
here is the actual code:

use strict;
use warnings;
use Cwd;
chdir "L:\\Console";
my $dir = getcwd();
print "current dir is : $dir\n";
my $res = system("dir");
$res=system("devenv","/rebuild","release","abc.sln","/useenv");
print "$res\n";

now, the issue is , at last the value of $res is 256 instead of the real output of command. just to give details, devenv is the compiler which compiles the solution file. i need to compile the solution file abc.sln and print the entire output of command on the console

The system function returns an error or success value. The standard output of the command executed by system should end up on your terminal.

If you want to capture the output of the command, use backticks or the qx operator:

my @output = qx( devenv /rebuild release abc.sln /useenv);

See 'perldoc -q system' "Why can't I get the output of a command with system()?"
and 'perldoc -f system'.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to