use strict; use warnings; my $cmd = 'copy.exe 'from', 'to', '/z' |'; open(EXE, $cmd) || die "$!"; while(){ print "read from program output: ".$_."\n"; } print "done.\n"; close(EXE);