gdanenb has asked for the wisdom of the Perl Monks concerning the following question:
I want to get both stdout and stderr into $var, and get correct $? I went through solutions in perlfac8 and forums The strange thing that I DON'T get sdterr in any case, as long as correct result code. perl version is 5.8.8, Linux RH 5
my $cmd="lsss"; my $out=`$cmd 2>&1`; or my $out=qx($cmd 2>&1); or open(PIPE, "$cmd 2>&1|");
stdout when command is correct I get ok. I don't want to use additional *capture* modules.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: STDOUT STDERR and response code from external Linix command
by zentara (Cardinal) on Jan 05, 2012 at 12:49 UTC | |
Re: STDOUT STDERR and response code from external Linix command
by mr.nick (Chaplain) on Jan 04, 2012 at 21:21 UTC | |
by Eliya (Vicar) on Jan 04, 2012 at 21:49 UTC | |
by gdanenb (Acolyte) on Jan 05, 2012 at 06:41 UTC | |
by Eliya (Vicar) on Jan 05, 2012 at 11:01 UTC |