Share

Updated: October 6th, 2009

2 Responses to “How Do I Get Both The Return Value And Text In Perl? Backticks vs. System() (Perl 5.10)”

    2 Comments:
  1. nogod says:

    thats the wrong variable… the exit statius as returned by system has always been available in $?, just like in the shell. that has always been documented… your variable does something else (and is indeed new).

    $? The status returned by the last pipe close, backtick (""") command, successful call to
    wait() or waitpid(), or from the system() operator.

  2. nogod, hrm, you're right, I don't know why I thought it was new. http://search.cpan.org/~rgarcia/perl-5.10.0/pod/perl5100delta.pod#New_internal_variables lists it as new and the only difference I can see between that and $? is the "native" part. What's so native about it, I'm not sure.

    ${^CHILD_ERROR_NATIVE}

    This variable gives the native status returned by the last pipe close, backtick command, successful call to wait() or waitpid(), or from the system() operator. See perlrun for details. (Contributed by Gisle Aas.)

Leave a Reply

Connect with Facebook