#!/usr/bin/perl use warnings; use strict; open (IN, '-|', 'perl PrintStdoutStdErr.pl') or die "$!"; while () { print; } __END__ prints: this went to STDERR this went to STDOUT #### #!/usr/bin/perl use warnings; use strict; $|=1; print STDOUT "this went to STDOUT\n"; print STDERR "this went to STDERR\n";