$ (echo -n a; sleep 2; echo -n b; sleep 2; echo -n c) | perl -e'for (1..3) {print "Q$_ -> "; read STDIN,$r,1; print "$r\n";}' Q1 -> a Q2 -> b Q3 -> c