http://www.perlmonks.org?node_id=486208


in reply to Best method to capture return code from system calls?

I use the following to return both the status and the captured STDOUT/STDERR. It is not as simple as just checking for non-zero return status - there are bits that must be ignored.

sub executeCommand { my $command = join ' ', @_; reverse ($_ = qx{$command 2>&1}, $? >> 8); }
Would someone please critique this approach?



pbeckingham - typist, perishable vertebrate.