#Run the command open( CMD, "$run_cmd|" ) || die "Not able to run \"$run_cmd\":$!\n"; while( ){ # read command's output from the pipe # do write to file with what we read back from the proces print $fh_cmd_in $_; }