in reply to STDERR and STDOUT redirection from codeopen/code
This will do the trick for you (on *nix):
my $command = 'ls -al'; open CMD, "$command 2>&1|" or die $!; my @output = <CMD>; close CMD;
The open executes $command. The 2>&1 redirects STDERR to STDOUT and backgrounds process. The | pipes the output to the CMD filehandle which we then read from as usual.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: STDERR and STDOUT redirection from codeopen/code
by dpatrick (Scribe) on Apr 11, 2002 at 20:24 UTC |