$h = start /@cmd, /$in ,/$out; $in .= "some command"; pump $h until $out=~/some desired string/i; #### $in.="some command"; $t->time(5);