in reply to system stdout redirected ok to a file but not to a variable.
(not tested)my $cmdout = "/tmp/cmd.stdout.$$"; my $cmderr = "/tmp/cmd.stderr.$$"; system( "my_special_command > $cmdout 2> $cmderr" ); my $exitcode = ( $? >> 8 ); for my $log ( $cmdout, $cmderr ) { open( my $logfh, "<", $log ) or die "WTF? $!"; local $/; my $logdata = <$logfh>; # now what? } unlink $cmdout, $cmderr;
|
|---|