in reply to Synchronizing STDERR and STDOUT
use strict; my $cmd = 'perl -e "die( q[report this error] )" 2>&1'; if ( ! open( FIN, "$cmd |" ) ) { die( "Could not run $cmd: $!" ); } my $input = join( '', <FIN> ); close( FIN ); print( "My input was:\n$input\n--end--\n" );
C:\temp>perl -w perlwinredirect.pl My input was: report this error at -e line 1. --end--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Synchronizing STDERR and STDOUT
by Ovid (Cardinal) on Sep 21, 2006 at 11:13 UTC |