perl -E" $pid = open IN, '-|', qq[perl -E\"say for 1 .. 100e6\"]; while(){ $n+=length; print; kill(3,$pid),last if $n>1e5 }" > output.file