- or download this
open FILE, "|du -sk|" or die "$!";
print FILE `ls`;
print while(<FILE>);
- or download this
The open2() function runs the given $cmd and connects $rdrfh
for reading and $wtrfh for writing. It's what you think
...
$pid = open(HANDLE, "|cmd args|");
The write filehandle will have autoflush turned on.
- or download this
use IPC::Open2;
...
# or without using the shell
$pid = open2($rdrfh, $wtrfh, 'some', 'cmd', 'and', 'args');