#!/usr/bin/perl use strict; use warnings; $|=1; my $p2 = "./p2.pl"; open(P2,"$p2 |") || die "P2: $p2 - $!\n"; while( read( P2, $_, 1 ) ) { # fixed as per [ikegami]'s post below print; }