$fh = new IO::File; open($fh,"$cmd 2>&1 |"); do { ($eof,@lines) = nonblockGetLines($fh); foreach my $line ( @lines ) { print "Pipe saw: [$line]\n"; } } until $eof; close $fh;