#!/usr/bin/perl use strict; $SIG{PIPE} = 'IGNORE'; open( PIPE, "|net2.pl" ) or die "Cannot open pipe:$!"; select PIPE; $| = 1; select STDOUT; my $count = 0; for ( 1 .. 10 ) { warn "Writing line $_\n"; if ( print PIPE "This is line number $_\n" ) { $count++; } else { warn " An error occured during writing :$!"; last; } sleep 1; } close PIPE or die " Cannot close pipe : $!"; print "Wrote $count lines of text \n";