open FILE, "|du -sk|" or die "$!"; print FILE `ls`; print while(); #### The open2() function runs the given $cmd and connects $rdrfh for reading and $wtrfh for writing. It's what you think should work when you try $pid = open(HANDLE, "|cmd args|"); The write filehandle will have autoflush turned on. #### use IPC::Open2; $pid = open2(\*RDRFH, \*WTRFH, 'some cmd and args'); # or without using the shell $pid = open2(\*RDRFH, \*WTRFH, 'some', 'cmd', 'and', 'args'); # or with handle autovivification my($rdrfh, $wtrfh); $pid = open2($rdrfh, $wtrfh, 'some cmd and args'); # or without using the shell $pid = open2($rdrfh, $wtrfh, 'some', 'cmd', 'and', 'args');