$in .= "new data\n"; pump $handle until $out =~ /data arrived:/; print $out;