open (FOO, "foo.exe |") # Spawn foo.exe with a pipe
or die "Couldn't fork: $!";
while (my $line = <FOO>)
{
[...]
}
close (FOO);
my $ret = $?; # Get return code.
That will run foo.exe, and pipe its output, in real-time, to the file stream
FOO. So, every line that foo.exe outputs to its stdout will come into your
while loop (in $line). The while loop will exit when foo.exe finishes.
After the close, $? will contain the return code of foo.exe.
You can verify this in "perldoc perlfunc" under 'open'.
-----Original Message-----
From: Hogue, Jon [mailto:[EMAIL PROTECTED]]
Sent: May 16, 2000 12:11 PM
To: Perl-Win32-Users Mailing List
Subject: system();
I want to run a dos command and play with the output of the command.
For example,
If I do system("foo.exe"), how do I get the ouput of foo.exe. (not the exit
status).
---
You are currently subscribed to perl-win32-users as:
[EMAIL PROTECTED]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]