In perl, system() runs a command and returns exit status information, simply like

    $exit_status   = system("ls");

as a 16 bit value: the low 7 bits are the signal the process died from, if any, and the high 8 bits are the actual exit value. Below is an example of script which capture the system() status

  if( ($sysres=system($cmd)) ) { ## then command failed.
    $err = $!;
    if( $sysres == -1 ) {
      logMsg( "Failed to exec", _LOG );
      $res = 4;
    }
    elsif( $sysres & 127 ) {
      $res = ($sysres & 127);
      logMsg( "Child died with signal $res", _LOG );
    }
    else {
      $res = ($sysres >> 8);
      logMsg( "Child died with value $res", _LOG );
    }

Backticks (``) run a command and return what it sent to STDOUT. Like:

    $output_string = `ls`;

As you can see, system() doesn't yield command output, while backticks doesn't return command return code.

How to capture them both?

One way is to redirect command output to a temporary file when calling system()

  my $errf = POSIX::tmpnam();
  my( $sysres, $err );
  $cmd = $1;
  $cmd .= " 2> $errf";

if( ($sysres=system($cmd)) )

...

if( open( FILE, $errf ) ) {
  logMsg( "Output from command follows:", _LOG );

...