#!/usr/bin/perl -w open (PIPE,"printsth |") or die $!; while() {print; last if $i++ >=1000; } close(PIPE) or die "Quit with exit status: $? message: $!" ; #### #prog printsth #!/usr/bin/perl -w print "hi there", $/ while(1); #### hi there .... .... hi there hi there Quit with exit status: 13 message: at termpipe line 7.