#!/usr/bin/perl use warnings; use strict; for my $step (1..4) { sleep 3; print "Step $step\n"; } #### #!/usr/bin/perl use warnings; use strict; $|++; open PIPE1, "./blackbox.pl |"; while ( ) { # ...Filter and munge $_ print $_; } close PIPE1;