perl -e "$|=1; print 'test1'; sleep 1; print 'test2'" | perl -e "sysread(STDIN, $buf='', 1000); print(qq{[$buf]})" #### [test1]