my $pid = open2(*HIS_OUT, *HIS_IN, "/my/application" ) || die $!; sleep 3; print HIS_IN "quit\n"; while ( ) { chomp; &do_something_to($_); }