----- Original Message ----- From: "Somu" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: <Beginners@perl.org>
Sent: Friday, September 21, 2007 11:27 AM
Subject: System


About that PID problem, i found a program in Windows named tasklist,
it prints all the processes running on the system with its id. I used
the system command to execute the tasklist, like as

my $data = system "tasklist" ;

but i got nothing in $data. How can i get the data from the system command?

Hi Somu

You can't capture data with 'system'.

From the documentation for system:

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 the perlop manpage. Return value of -1 indicates a failure to start the program or an error of the wait(2) system call (inspect $! for the reason).

Chris


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


Reply via email to