in reply to Re: Re: X10 and Windows
in thread X10 and Windows

Try this:
my @test = system($command) ; print @test ;

This will give you the command output. Example:
#!/usr/bin/perl -w use strict ; my @test = system("dir") ; print @test ;

Will give you:
Volume in drive E is E_Drive Volume Serial Number is XXXX-XXXX Directory of E:\TempCode\test 08/06/2002 11:05a <DIR> . 08/06/2002 11:05a <DIR> .. 08/06/2002 11:05a 1,336 systemCommand.pl 1 File(s) 1,336 bytes 2 Dir(s) 1,629,966,336 bytes free 0
While:
#!/usr/bin/perl -w use strict ; my @test = system("dirt") ; print @test ;

Will give you:
'dirt' is not recognized as an internal or external command, operable program or batch file. 256
This should be usefull in at least telling you if the command is being executed and what the results are.

"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!

Replies are listed 'Best First'.
Re: Re: Re: Re: X10 and Windows
by Anonymous Monk on Aug 07, 2002 at 02:11 UTC
    Thanks, This was helpful, but unfortunatley it returned the number '256' Anyone have anyidea what that relates to? Thanks
      quoted from man page regarding system() :
                     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).
      
      You can get to this by issuing the "perldoc -f system" command.

      Tiago